@typescript-deploys/pr-build 5.4.0-pr-56908-56 → 5.4.0-pr-56034-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -16070,7 +16070,7 @@ function Symbol4(flags, name) {
16070
16070
  this.exportSymbol = void 0;
16071
16071
  this.constEnumOnlyModule = void 0;
16072
16072
  this.isReferenced = void 0;
16073
- this.lastAssignmentPos = void 0;
16073
+ this.isAssigned = void 0;
16074
16074
  this.links = void 0;
16075
16075
  }
16076
16076
  function Type3(checker, flags) {
@@ -17492,6 +17492,13 @@ function hasContextSensitiveParameters(node) {
17492
17492
  function isInfinityOrNaNString(name) {
17493
17493
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
17494
17494
  }
17495
+ function isCatchClauseVariableDeclaration(node) {
17496
+ return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
17497
+ }
17498
+ function isParameterOrCatchClauseVariable(symbol) {
17499
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
17500
+ return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
17501
+ }
17495
17502
  function isFunctionExpressionOrArrowFunction(node) {
17496
17503
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
17497
17504
  }
@@ -17665,6 +17672,9 @@ var stringReplace = String.prototype.replace;
17665
17672
  function replaceFirstStar(s, replacement) {
17666
17673
  return stringReplace.call(s, "*", replacement);
17667
17674
  }
17675
+ function getNameFromImportAttribute(node) {
17676
+ return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
17677
+ }
17668
17678
 
17669
17679
  // src/compiler/factory/baseNodeFactory.ts
17670
17680
  function createBaseNodeFactory() {
@@ -44432,6 +44442,7 @@ function createTypeChecker(host) {
44432
44442
  var deferredGlobalImportMetaType;
44433
44443
  var deferredGlobalImportMetaExpressionType;
44434
44444
  var deferredGlobalImportCallOptionsType;
44445
+ var deferredGlobalImportAttributesType;
44435
44446
  var deferredGlobalDisposableType;
44436
44447
  var deferredGlobalAsyncDisposableType;
44437
44448
  var deferredGlobalExtractSymbol;
@@ -52732,6 +52743,24 @@ function createTypeChecker(host) {
52732
52743
  0 /* Normal */
52733
52744
  ), declaration, reportErrors2);
52734
52745
  }
52746
+ function getTypeFromImportAttributes(node) {
52747
+ const links = getNodeLinks(node);
52748
+ if (!links.resolvedType) {
52749
+ const symbol = createSymbol(4096 /* ObjectLiteral */, "__importAttributes" /* ImportAttributes */);
52750
+ const members = createSymbolTable();
52751
+ forEach(node.elements, (attr) => {
52752
+ const member = createSymbol(4 /* Property */, getNameFromImportAttribute(attr));
52753
+ member.parent = symbol;
52754
+ member.links.type = checkImportAttribute(attr);
52755
+ member.links.target = member;
52756
+ members.set(member.escapedName, member);
52757
+ });
52758
+ const type = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
52759
+ type.objectFlags |= 128 /* ObjectLiteral */ | 262144 /* NonInferrableType */;
52760
+ links.resolvedType = type;
52761
+ }
52762
+ return links.resolvedType;
52763
+ }
52735
52764
  function isGlobalSymbolConstructor(node) {
52736
52765
  const symbol = getSymbolOfNode(node);
52737
52766
  const globalSymbol = getGlobalESSymbolConstructorTypeSymbol(
@@ -56713,6 +56742,14 @@ function createTypeChecker(host) {
56713
56742
  reportErrors2
56714
56743
  )) || emptyObjectType;
56715
56744
  }
56745
+ function getGlobalImportAttributesType(reportErrors2) {
56746
+ return deferredGlobalImportAttributesType || (deferredGlobalImportAttributesType = getGlobalType(
56747
+ "ImportAttributes",
56748
+ /*arity*/
56749
+ 0,
56750
+ reportErrors2
56751
+ )) || emptyObjectType;
56752
+ }
56716
56753
  function getGlobalESSymbolConstructorSymbol(reportErrors2) {
56717
56754
  return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors2));
56718
56755
  }
@@ -66171,7 +66208,7 @@ function createTypeChecker(host) {
66171
66208
  case 80 /* Identifier */:
66172
66209
  if (!isThisInTypeQuery(node)) {
66173
66210
  const symbol = getResolvedSymbol(node);
66174
- return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
66211
+ return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
66175
66212
  }
66176
66213
  break;
66177
66214
  case 211 /* PropertyAccessExpression */:
@@ -67261,17 +67298,10 @@ function createTypeChecker(host) {
67261
67298
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
67262
67299
  }
67263
67300
  function isSymbolAssigned(symbol) {
67264
- return !isPastLastAssignment(
67265
- symbol,
67266
- /*location*/
67267
- void 0
67268
- );
67269
- }
67270
- function isPastLastAssignment(symbol, location) {
67271
- const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
67272
- if (!parent) {
67301
+ if (!symbol.valueDeclaration) {
67273
67302
  return false;
67274
67303
  }
67304
+ const parent = getRootDeclaration(symbol.valueDeclaration).parent;
67275
67305
  const links = getNodeLinks(parent);
67276
67306
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
67277
67307
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -67279,7 +67309,7 @@ function createTypeChecker(host) {
67279
67309
  markNodeAssignments(parent);
67280
67310
  }
67281
67311
  }
67282
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
67312
+ return symbol.isAssigned || false;
67283
67313
  }
67284
67314
  function isSomeSymbolAssigned(rootDeclaration) {
67285
67315
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -67292,81 +67322,23 @@ function createTypeChecker(host) {
67292
67322
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
67293
67323
  }
67294
67324
  function hasParentWithAssignmentsMarked(node) {
67295
- return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
67296
- }
67297
- function isFunctionOrSourceFile(node) {
67298
- return isFunctionLikeDeclaration(node) || isSourceFile(node);
67325
+ return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
67299
67326
  }
67300
67327
  function markNodeAssignments(node) {
67301
- switch (node.kind) {
67302
- case 80 /* Identifier */:
67303
- if (isAssignmentTarget(node)) {
67304
- const symbol = getResolvedSymbol(node);
67305
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
67306
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
67307
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
67308
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
67309
- }
67310
- }
67311
- return;
67312
- case 281 /* ExportSpecifier */:
67313
- const exportDeclaration = node.parent.parent;
67314
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
67315
- const symbol = resolveEntityName(
67316
- node.propertyName || node.name,
67317
- 111551 /* Value */,
67318
- /*ignoreErrors*/
67319
- true,
67320
- /*dontResolveAlias*/
67321
- true
67322
- );
67323
- if (symbol && isParameterOrMutableLocalVariable(symbol)) {
67324
- symbol.lastAssignmentPos = Number.MAX_VALUE;
67325
- }
67328
+ if (node.kind === 80 /* Identifier */) {
67329
+ if (isAssignmentTarget(node)) {
67330
+ const symbol = getResolvedSymbol(node);
67331
+ if (isParameterOrCatchClauseVariable(symbol)) {
67332
+ symbol.isAssigned = true;
67326
67333
  }
67327
- return;
67328
- case 264 /* InterfaceDeclaration */:
67329
- case 265 /* TypeAliasDeclaration */:
67330
- case 266 /* EnumDeclaration */:
67331
- return;
67332
- }
67333
- if (isTypeNode(node)) {
67334
- return;
67335
- }
67336
- forEachChild(node, markNodeAssignments);
67337
- }
67338
- function extendAssignmentPosition(node, declaration) {
67339
- let pos = node.pos;
67340
- while (node && node.pos > declaration.pos) {
67341
- switch (node.kind) {
67342
- case 243 /* VariableStatement */:
67343
- case 244 /* ExpressionStatement */:
67344
- case 245 /* IfStatement */:
67345
- case 246 /* DoStatement */:
67346
- case 247 /* WhileStatement */:
67347
- case 248 /* ForStatement */:
67348
- case 249 /* ForInStatement */:
67349
- case 250 /* ForOfStatement */:
67350
- case 254 /* WithStatement */:
67351
- case 255 /* SwitchStatement */:
67352
- case 258 /* TryStatement */:
67353
- case 263 /* ClassDeclaration */:
67354
- pos = node.end;
67355
67334
  }
67356
- node = node.parent;
67335
+ } else {
67336
+ forEachChild(node, markNodeAssignments);
67357
67337
  }
67358
- return pos;
67359
67338
  }
67360
67339
  function isConstantVariable(symbol) {
67361
67340
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
67362
67341
  }
67363
- function isParameterOrMutableLocalVariable(symbol) {
67364
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
67365
- return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
67366
- }
67367
- function isMutableLocalVariableDeclaration(declaration) {
67368
- return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
67369
- }
67370
67342
  function parameterInitializerContainsUndefined(declaration) {
67371
67343
  const links = getNodeLinks(declaration);
67372
67344
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -67615,7 +67587,7 @@ function createTypeChecker(host) {
67615
67587
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
67616
67588
  const typeIsAutomatic = type === autoType || type === autoArrayType;
67617
67589
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
67618
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
67590
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
67619
67591
  flowContainer = getControlFlowContainer(flowContainer);
67620
67592
  }
67621
67593
  const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
@@ -68886,6 +68858,8 @@ function createTypeChecker(host) {
68886
68858
  case 286 /* JsxOpeningElement */:
68887
68859
  case 285 /* JsxSelfClosingElement */:
68888
68860
  return getContextualJsxElementAttributesType(parent, contextFlags);
68861
+ case 301 /* ImportAttribute */:
68862
+ return getContextualImportAttributeType(parent);
68889
68863
  }
68890
68864
  return void 0;
68891
68865
  }
@@ -68933,6 +68907,12 @@ function createTypeChecker(host) {
68933
68907
  }
68934
68908
  }
68935
68909
  }
68910
+ function getContextualImportAttributeType(node) {
68911
+ return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
68912
+ /*reportErrors*/
68913
+ false
68914
+ ), getNameFromImportAttribute(node));
68915
+ }
68936
68916
  function getContextualJsxElementAttributesType(node, contextFlags) {
68937
68917
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
68938
68918
  const index = findContextualNode(
@@ -81018,6 +80998,13 @@ function createTypeChecker(host) {
81018
80998
  var _a;
81019
80999
  const node = declaration.attributes;
81020
81000
  if (node) {
81001
+ const importAttributesType = getGlobalImportAttributesType(
81002
+ /*reportErrors*/
81003
+ true
81004
+ );
81005
+ if (importAttributesType !== emptyObjectType) {
81006
+ checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
81007
+ }
81021
81008
  const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
81022
81009
  const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
81023
81010
  const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
@@ -81037,6 +81024,9 @@ function createTypeChecker(host) {
81037
81024
  }
81038
81025
  }
81039
81026
  }
81027
+ function checkImportAttribute(node) {
81028
+ return getRegularTypeOfLiteralType(checkExpressionCached(node.value));
81029
+ }
81040
81030
  function checkImportDeclaration(node) {
81041
81031
  if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
81042
81032
  return;
@@ -82452,6 +82442,12 @@ function createTypeChecker(host) {
82452
82442
  if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
82453
82443
  return checkMetaPropertyKeyword(node.parent);
82454
82444
  }
82445
+ if (isImportAttributes(node)) {
82446
+ return getGlobalImportAttributesType(
82447
+ /*reportErrors*/
82448
+ false
82449
+ );
82450
+ }
82455
82451
  return errorType;
82456
82452
  }
82457
82453
  function getTypeOfAssignmentPattern(expr) {
package/lib/tsserver.js CHANGED
@@ -898,6 +898,7 @@ __export(server_exports, {
898
898
  getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
899
899
  getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
900
900
  getNameForExportedSymbol: () => getNameForExportedSymbol,
901
+ getNameFromImportAttribute: () => getNameFromImportAttribute,
901
902
  getNameFromIndexInfo: () => getNameFromIndexInfo,
902
903
  getNameFromPropertyName: () => getNameFromPropertyName,
903
904
  getNameOfAccessExpression: () => getNameOfAccessExpression,
@@ -1253,6 +1254,7 @@ __export(server_exports, {
1253
1254
  isCaseKeyword: () => isCaseKeyword,
1254
1255
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
1255
1256
  isCatchClause: () => isCatchClause,
1257
+ isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
1256
1258
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
1257
1259
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
1258
1260
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -1654,6 +1656,7 @@ __export(server_exports, {
1654
1656
  isPackedArrayLiteral: () => isPackedArrayLiteral,
1655
1657
  isParameter: () => isParameter,
1656
1658
  isParameterDeclaration: () => isParameterDeclaration,
1659
+ isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
1657
1660
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
1658
1661
  isParameterPropertyModifier: () => isParameterPropertyModifier,
1659
1662
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -6598,6 +6601,7 @@ var InternalSymbolName = /* @__PURE__ */ ((InternalSymbolName2) => {
6598
6601
  InternalSymbolName2["Default"] = "default";
6599
6602
  InternalSymbolName2["This"] = "this";
6600
6603
  InternalSymbolName2["InstantiationExpression"] = "__instantiationExpression";
6604
+ InternalSymbolName2["ImportAttributes"] = "__importAttributes";
6601
6605
  return InternalSymbolName2;
6602
6606
  })(InternalSymbolName || {});
6603
6607
  var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
@@ -20239,7 +20243,7 @@ function Symbol4(flags, name) {
20239
20243
  this.exportSymbol = void 0;
20240
20244
  this.constEnumOnlyModule = void 0;
20241
20245
  this.isReferenced = void 0;
20242
- this.lastAssignmentPos = void 0;
20246
+ this.isAssigned = void 0;
20243
20247
  this.links = void 0;
20244
20248
  }
20245
20249
  function Type3(checker, flags) {
@@ -21711,6 +21715,13 @@ function hasContextSensitiveParameters(node) {
21711
21715
  function isInfinityOrNaNString(name) {
21712
21716
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
21713
21717
  }
21718
+ function isCatchClauseVariableDeclaration(node) {
21719
+ return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
21720
+ }
21721
+ function isParameterOrCatchClauseVariable(symbol) {
21722
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
21723
+ return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
21724
+ }
21714
21725
  function isFunctionExpressionOrArrowFunction(node) {
21715
21726
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
21716
21727
  }
@@ -21895,6 +21906,9 @@ var stringReplace = String.prototype.replace;
21895
21906
  function replaceFirstStar(s, replacement) {
21896
21907
  return stringReplace.call(s, "*", replacement);
21897
21908
  }
21909
+ function getNameFromImportAttribute(node) {
21910
+ return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
21911
+ }
21898
21912
 
21899
21913
  // src/compiler/factory/baseNodeFactory.ts
21900
21914
  function createBaseNodeFactory() {
@@ -49169,6 +49183,7 @@ function createTypeChecker(host) {
49169
49183
  var deferredGlobalImportMetaType;
49170
49184
  var deferredGlobalImportMetaExpressionType;
49171
49185
  var deferredGlobalImportCallOptionsType;
49186
+ var deferredGlobalImportAttributesType;
49172
49187
  var deferredGlobalDisposableType;
49173
49188
  var deferredGlobalAsyncDisposableType;
49174
49189
  var deferredGlobalExtractSymbol;
@@ -57469,6 +57484,24 @@ function createTypeChecker(host) {
57469
57484
  0 /* Normal */
57470
57485
  ), declaration, reportErrors2);
57471
57486
  }
57487
+ function getTypeFromImportAttributes(node) {
57488
+ const links = getNodeLinks(node);
57489
+ if (!links.resolvedType) {
57490
+ const symbol = createSymbol(4096 /* ObjectLiteral */, "__importAttributes" /* ImportAttributes */);
57491
+ const members = createSymbolTable();
57492
+ forEach(node.elements, (attr) => {
57493
+ const member = createSymbol(4 /* Property */, getNameFromImportAttribute(attr));
57494
+ member.parent = symbol;
57495
+ member.links.type = checkImportAttribute(attr);
57496
+ member.links.target = member;
57497
+ members.set(member.escapedName, member);
57498
+ });
57499
+ const type = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
57500
+ type.objectFlags |= 128 /* ObjectLiteral */ | 262144 /* NonInferrableType */;
57501
+ links.resolvedType = type;
57502
+ }
57503
+ return links.resolvedType;
57504
+ }
57472
57505
  function isGlobalSymbolConstructor(node) {
57473
57506
  const symbol = getSymbolOfNode(node);
57474
57507
  const globalSymbol = getGlobalESSymbolConstructorTypeSymbol(
@@ -61450,6 +61483,14 @@ function createTypeChecker(host) {
61450
61483
  reportErrors2
61451
61484
  )) || emptyObjectType;
61452
61485
  }
61486
+ function getGlobalImportAttributesType(reportErrors2) {
61487
+ return deferredGlobalImportAttributesType || (deferredGlobalImportAttributesType = getGlobalType(
61488
+ "ImportAttributes",
61489
+ /*arity*/
61490
+ 0,
61491
+ reportErrors2
61492
+ )) || emptyObjectType;
61493
+ }
61453
61494
  function getGlobalESSymbolConstructorSymbol(reportErrors2) {
61454
61495
  return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors2));
61455
61496
  }
@@ -70908,7 +70949,7 @@ function createTypeChecker(host) {
70908
70949
  case 80 /* Identifier */:
70909
70950
  if (!isThisInTypeQuery(node)) {
70910
70951
  const symbol = getResolvedSymbol(node);
70911
- return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
70952
+ return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
70912
70953
  }
70913
70954
  break;
70914
70955
  case 211 /* PropertyAccessExpression */:
@@ -71998,17 +72039,10 @@ function createTypeChecker(host) {
71998
72039
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
71999
72040
  }
72000
72041
  function isSymbolAssigned(symbol) {
72001
- return !isPastLastAssignment(
72002
- symbol,
72003
- /*location*/
72004
- void 0
72005
- );
72006
- }
72007
- function isPastLastAssignment(symbol, location) {
72008
- const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
72009
- if (!parent2) {
72042
+ if (!symbol.valueDeclaration) {
72010
72043
  return false;
72011
72044
  }
72045
+ const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
72012
72046
  const links = getNodeLinks(parent2);
72013
72047
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
72014
72048
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -72016,7 +72050,7 @@ function createTypeChecker(host) {
72016
72050
  markNodeAssignments(parent2);
72017
72051
  }
72018
72052
  }
72019
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
72053
+ return symbol.isAssigned || false;
72020
72054
  }
72021
72055
  function isSomeSymbolAssigned(rootDeclaration) {
72022
72056
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -72029,81 +72063,23 @@ function createTypeChecker(host) {
72029
72063
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
72030
72064
  }
72031
72065
  function hasParentWithAssignmentsMarked(node) {
72032
- return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
72033
- }
72034
- function isFunctionOrSourceFile(node) {
72035
- return isFunctionLikeDeclaration(node) || isSourceFile(node);
72066
+ return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
72036
72067
  }
72037
72068
  function markNodeAssignments(node) {
72038
- switch (node.kind) {
72039
- case 80 /* Identifier */:
72040
- if (isAssignmentTarget(node)) {
72041
- const symbol = getResolvedSymbol(node);
72042
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
72043
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
72044
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
72045
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
72046
- }
72047
- }
72048
- return;
72049
- case 281 /* ExportSpecifier */:
72050
- const exportDeclaration = node.parent.parent;
72051
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
72052
- const symbol = resolveEntityName(
72053
- node.propertyName || node.name,
72054
- 111551 /* Value */,
72055
- /*ignoreErrors*/
72056
- true,
72057
- /*dontResolveAlias*/
72058
- true
72059
- );
72060
- if (symbol && isParameterOrMutableLocalVariable(symbol)) {
72061
- symbol.lastAssignmentPos = Number.MAX_VALUE;
72062
- }
72069
+ if (node.kind === 80 /* Identifier */) {
72070
+ if (isAssignmentTarget(node)) {
72071
+ const symbol = getResolvedSymbol(node);
72072
+ if (isParameterOrCatchClauseVariable(symbol)) {
72073
+ symbol.isAssigned = true;
72063
72074
  }
72064
- return;
72065
- case 264 /* InterfaceDeclaration */:
72066
- case 265 /* TypeAliasDeclaration */:
72067
- case 266 /* EnumDeclaration */:
72068
- return;
72069
- }
72070
- if (isTypeNode(node)) {
72071
- return;
72072
- }
72073
- forEachChild(node, markNodeAssignments);
72074
- }
72075
- function extendAssignmentPosition(node, declaration) {
72076
- let pos = node.pos;
72077
- while (node && node.pos > declaration.pos) {
72078
- switch (node.kind) {
72079
- case 243 /* VariableStatement */:
72080
- case 244 /* ExpressionStatement */:
72081
- case 245 /* IfStatement */:
72082
- case 246 /* DoStatement */:
72083
- case 247 /* WhileStatement */:
72084
- case 248 /* ForStatement */:
72085
- case 249 /* ForInStatement */:
72086
- case 250 /* ForOfStatement */:
72087
- case 254 /* WithStatement */:
72088
- case 255 /* SwitchStatement */:
72089
- case 258 /* TryStatement */:
72090
- case 263 /* ClassDeclaration */:
72091
- pos = node.end;
72092
72075
  }
72093
- node = node.parent;
72076
+ } else {
72077
+ forEachChild(node, markNodeAssignments);
72094
72078
  }
72095
- return pos;
72096
72079
  }
72097
72080
  function isConstantVariable(symbol) {
72098
72081
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
72099
72082
  }
72100
- function isParameterOrMutableLocalVariable(symbol) {
72101
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
72102
- return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
72103
- }
72104
- function isMutableLocalVariableDeclaration(declaration) {
72105
- return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
72106
- }
72107
72083
  function parameterInitializerContainsUndefined(declaration) {
72108
72084
  const links = getNodeLinks(declaration);
72109
72085
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -72352,7 +72328,7 @@ function createTypeChecker(host) {
72352
72328
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
72353
72329
  const typeIsAutomatic = type === autoType || type === autoArrayType;
72354
72330
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
72355
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
72331
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
72356
72332
  flowContainer = getControlFlowContainer(flowContainer);
72357
72333
  }
72358
72334
  const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
@@ -73623,6 +73599,8 @@ function createTypeChecker(host) {
73623
73599
  case 286 /* JsxOpeningElement */:
73624
73600
  case 285 /* JsxSelfClosingElement */:
73625
73601
  return getContextualJsxElementAttributesType(parent2, contextFlags);
73602
+ case 301 /* ImportAttribute */:
73603
+ return getContextualImportAttributeType(parent2);
73626
73604
  }
73627
73605
  return void 0;
73628
73606
  }
@@ -73670,6 +73648,12 @@ function createTypeChecker(host) {
73670
73648
  }
73671
73649
  }
73672
73650
  }
73651
+ function getContextualImportAttributeType(node) {
73652
+ return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
73653
+ /*reportErrors*/
73654
+ false
73655
+ ), getNameFromImportAttribute(node));
73656
+ }
73673
73657
  function getContextualJsxElementAttributesType(node, contextFlags) {
73674
73658
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
73675
73659
  const index = findContextualNode(
@@ -85755,6 +85739,13 @@ function createTypeChecker(host) {
85755
85739
  var _a;
85756
85740
  const node = declaration.attributes;
85757
85741
  if (node) {
85742
+ const importAttributesType = getGlobalImportAttributesType(
85743
+ /*reportErrors*/
85744
+ true
85745
+ );
85746
+ if (importAttributesType !== emptyObjectType) {
85747
+ checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
85748
+ }
85758
85749
  const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
85759
85750
  const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
85760
85751
  const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
@@ -85774,6 +85765,9 @@ function createTypeChecker(host) {
85774
85765
  }
85775
85766
  }
85776
85767
  }
85768
+ function checkImportAttribute(node) {
85769
+ return getRegularTypeOfLiteralType(checkExpressionCached(node.value));
85770
+ }
85777
85771
  function checkImportDeclaration(node) {
85778
85772
  if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
85779
85773
  return;
@@ -87189,6 +87183,12 @@ function createTypeChecker(host) {
87189
87183
  if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
87190
87184
  return checkMetaPropertyKeyword(node.parent);
87191
87185
  }
87186
+ if (isImportAttributes(node)) {
87187
+ return getGlobalImportAttributesType(
87188
+ /*reportErrors*/
87189
+ false
87190
+ );
87191
+ }
87192
87192
  return errorType;
87193
87193
  }
87194
87194
  function getTypeOfAssignmentPattern(expr) {
@@ -160809,7 +160809,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160809
160809
  return isIdentifier(e) ? e : isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : void 0;
160810
160810
  }
160811
160811
  function tryGetGlobalSymbols() {
160812
- const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
160812
+ const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetImportAttributesCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
160813
160813
  return result === 1 /* Success */;
160814
160814
  }
160815
160815
  function tryGetConstructorCompletion() {
@@ -161277,6 +161277,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
161277
161277
  }
161278
161278
  return 1 /* Success */;
161279
161279
  }
161280
+ function tryGetImportAttributesCompletionSymbols() {
161281
+ if (contextToken === void 0)
161282
+ return 0 /* Continue */;
161283
+ const importAttributes = contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */ ? tryCast(contextToken.parent, isImportAttributes) : void 0;
161284
+ if (importAttributes === void 0)
161285
+ return 0 /* Continue */;
161286
+ const existing = new Set(importAttributes.elements.map(getNameFromImportAttribute));
161287
+ symbols = filter(typeChecker.getTypeAtLocation(importAttributes).getApparentProperties(), (attr) => !existing.has(attr.escapedName));
161288
+ return 1 /* Success */;
161289
+ }
161280
161290
  function tryGetLocalNamedExportCompletionSymbols() {
161281
161291
  var _a;
161282
161292
  const namedExports = contextToken && (contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */) ? tryCast(contextToken.parent, isNamedExports) : void 0;
@@ -174783,6 +174793,7 @@ __export(ts_exports2, {
174783
174793
  getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
174784
174794
  getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
174785
174795
  getNameForExportedSymbol: () => getNameForExportedSymbol,
174796
+ getNameFromImportAttribute: () => getNameFromImportAttribute,
174786
174797
  getNameFromIndexInfo: () => getNameFromIndexInfo,
174787
174798
  getNameFromPropertyName: () => getNameFromPropertyName,
174788
174799
  getNameOfAccessExpression: () => getNameOfAccessExpression,
@@ -175138,6 +175149,7 @@ __export(ts_exports2, {
175138
175149
  isCaseKeyword: () => isCaseKeyword,
175139
175150
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
175140
175151
  isCatchClause: () => isCatchClause,
175152
+ isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
175141
175153
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
175142
175154
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
175143
175155
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -175539,6 +175551,7 @@ __export(ts_exports2, {
175539
175551
  isPackedArrayLiteral: () => isPackedArrayLiteral,
175540
175552
  isParameter: () => isParameter,
175541
175553
  isParameterDeclaration: () => isParameterDeclaration,
175554
+ isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
175542
175555
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
175543
175556
  isParameterPropertyModifier: () => isParameterPropertyModifier,
175544
175557
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -189582,6 +189595,7 @@ start(initializeNodeSystem(), require("os").platform());
189582
189595
  getModuleSpecifierEndingPreference,
189583
189596
  getModuleSpecifierResolverHost,
189584
189597
  getNameForExportedSymbol,
189598
+ getNameFromImportAttribute,
189585
189599
  getNameFromIndexInfo,
189586
189600
  getNameFromPropertyName,
189587
189601
  getNameOfAccessExpression,
@@ -189937,6 +189951,7 @@ start(initializeNodeSystem(), require("os").platform());
189937
189951
  isCaseKeyword,
189938
189952
  isCaseOrDefaultClause,
189939
189953
  isCatchClause,
189954
+ isCatchClauseVariableDeclaration,
189940
189955
  isCatchClauseVariableDeclarationOrBindingElement,
189941
189956
  isCheckJsEnabledForFile,
189942
189957
  isChildOfNodeWithKind,
@@ -190338,6 +190353,7 @@ start(initializeNodeSystem(), require("os").platform());
190338
190353
  isPackedArrayLiteral,
190339
190354
  isParameter,
190340
190355
  isParameterDeclaration,
190356
+ isParameterOrCatchClauseVariable,
190341
190357
  isParameterPropertyDeclaration,
190342
190358
  isParameterPropertyModifier,
190343
190359
  isParenthesizedExpression,
@@ -7069,6 +7069,7 @@ declare namespace ts {
7069
7069
  Default = "default",
7070
7070
  This = "this",
7071
7071
  InstantiationExpression = "__instantiationExpression",
7072
+ ImportAttributes = "__importAttributes",
7072
7073
  }
7073
7074
  /**
7074
7075
  * This represents a string whose leading underscore have been escaped by adding extra leading underscores.
package/lib/typescript.js CHANGED
@@ -4352,6 +4352,7 @@ ${lanes.join("\n")}
4352
4352
  InternalSymbolName2["Default"] = "default";
4353
4353
  InternalSymbolName2["This"] = "this";
4354
4354
  InternalSymbolName2["InstantiationExpression"] = "__instantiationExpression";
4355
+ InternalSymbolName2["ImportAttributes"] = "__importAttributes";
4355
4356
  return InternalSymbolName2;
4356
4357
  })(InternalSymbolName || {});
4357
4358
  NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
@@ -17529,7 +17530,7 @@ ${lanes.join("\n")}
17529
17530
  this.exportSymbol = void 0;
17530
17531
  this.constEnumOnlyModule = void 0;
17531
17532
  this.isReferenced = void 0;
17532
- this.lastAssignmentPos = void 0;
17533
+ this.isAssigned = void 0;
17533
17534
  this.links = void 0;
17534
17535
  }
17535
17536
  function Type3(checker, flags) {
@@ -18708,6 +18709,13 @@ ${lanes.join("\n")}
18708
18709
  function isInfinityOrNaNString(name) {
18709
18710
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
18710
18711
  }
18712
+ function isCatchClauseVariableDeclaration(node) {
18713
+ return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
18714
+ }
18715
+ function isParameterOrCatchClauseVariable(symbol) {
18716
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
18717
+ return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
18718
+ }
18711
18719
  function isFunctionExpressionOrArrowFunction(node) {
18712
18720
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
18713
18721
  }
@@ -18891,6 +18899,9 @@ ${lanes.join("\n")}
18891
18899
  function replaceFirstStar(s, replacement) {
18892
18900
  return stringReplace.call(s, "*", replacement);
18893
18901
  }
18902
+ function getNameFromImportAttribute(node) {
18903
+ return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
18904
+ }
18894
18905
  var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, getScriptTargetFeatures, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, computedOptions, getEmitScriptTarget, getEmitModuleKind, getEmitModuleResolutionKind, getEmitModuleDetectionKind, getIsolatedModules, getESModuleInterop, getAllowSyntheticDefaultImports, getResolvePackageJsonExports, getResolvePackageJsonImports, getResolveJsonModule, getEmitDeclarations, shouldPreserveConstEnums, isIncrementalCompilation, getAreDeclarationMapsEnabled, getAllowJSCompilerOption, getUseDefineForClassFields, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries, stringReplace;
18895
18906
  var init_utilities = __esm({
18896
18907
  "src/compiler/utilities.ts"() {
@@ -46925,6 +46936,7 @@ ${lanes.join("\n")}
46925
46936
  var deferredGlobalImportMetaType;
46926
46937
  var deferredGlobalImportMetaExpressionType;
46927
46938
  var deferredGlobalImportCallOptionsType;
46939
+ var deferredGlobalImportAttributesType;
46928
46940
  var deferredGlobalDisposableType;
46929
46941
  var deferredGlobalAsyncDisposableType;
46930
46942
  var deferredGlobalExtractSymbol;
@@ -55225,6 +55237,24 @@ ${lanes.join("\n")}
55225
55237
  0 /* Normal */
55226
55238
  ), declaration, reportErrors2);
55227
55239
  }
55240
+ function getTypeFromImportAttributes(node) {
55241
+ const links = getNodeLinks(node);
55242
+ if (!links.resolvedType) {
55243
+ const symbol = createSymbol(4096 /* ObjectLiteral */, "__importAttributes" /* ImportAttributes */);
55244
+ const members = createSymbolTable();
55245
+ forEach(node.elements, (attr) => {
55246
+ const member = createSymbol(4 /* Property */, getNameFromImportAttribute(attr));
55247
+ member.parent = symbol;
55248
+ member.links.type = checkImportAttribute(attr);
55249
+ member.links.target = member;
55250
+ members.set(member.escapedName, member);
55251
+ });
55252
+ const type = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
55253
+ type.objectFlags |= 128 /* ObjectLiteral */ | 262144 /* NonInferrableType */;
55254
+ links.resolvedType = type;
55255
+ }
55256
+ return links.resolvedType;
55257
+ }
55228
55258
  function isGlobalSymbolConstructor(node) {
55229
55259
  const symbol = getSymbolOfNode(node);
55230
55260
  const globalSymbol = getGlobalESSymbolConstructorTypeSymbol(
@@ -59206,6 +59236,14 @@ ${lanes.join("\n")}
59206
59236
  reportErrors2
59207
59237
  )) || emptyObjectType;
59208
59238
  }
59239
+ function getGlobalImportAttributesType(reportErrors2) {
59240
+ return deferredGlobalImportAttributesType || (deferredGlobalImportAttributesType = getGlobalType(
59241
+ "ImportAttributes",
59242
+ /*arity*/
59243
+ 0,
59244
+ reportErrors2
59245
+ )) || emptyObjectType;
59246
+ }
59209
59247
  function getGlobalESSymbolConstructorSymbol(reportErrors2) {
59210
59248
  return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors2));
59211
59249
  }
@@ -68664,7 +68702,7 @@ ${lanes.join("\n")}
68664
68702
  case 80 /* Identifier */:
68665
68703
  if (!isThisInTypeQuery(node)) {
68666
68704
  const symbol = getResolvedSymbol(node);
68667
- return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
68705
+ return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
68668
68706
  }
68669
68707
  break;
68670
68708
  case 211 /* PropertyAccessExpression */:
@@ -69754,17 +69792,10 @@ ${lanes.join("\n")}
69754
69792
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
69755
69793
  }
69756
69794
  function isSymbolAssigned(symbol) {
69757
- return !isPastLastAssignment(
69758
- symbol,
69759
- /*location*/
69760
- void 0
69761
- );
69762
- }
69763
- function isPastLastAssignment(symbol, location) {
69764
- const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69765
- if (!parent2) {
69795
+ if (!symbol.valueDeclaration) {
69766
69796
  return false;
69767
69797
  }
69798
+ const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
69768
69799
  const links = getNodeLinks(parent2);
69769
69800
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
69770
69801
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -69772,7 +69803,7 @@ ${lanes.join("\n")}
69772
69803
  markNodeAssignments(parent2);
69773
69804
  }
69774
69805
  }
69775
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
69806
+ return symbol.isAssigned || false;
69776
69807
  }
69777
69808
  function isSomeSymbolAssigned(rootDeclaration) {
69778
69809
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -69785,81 +69816,23 @@ ${lanes.join("\n")}
69785
69816
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
69786
69817
  }
69787
69818
  function hasParentWithAssignmentsMarked(node) {
69788
- return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
69789
- }
69790
- function isFunctionOrSourceFile(node) {
69791
- return isFunctionLikeDeclaration(node) || isSourceFile(node);
69819
+ return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
69792
69820
  }
69793
69821
  function markNodeAssignments(node) {
69794
- switch (node.kind) {
69795
- case 80 /* Identifier */:
69796
- if (isAssignmentTarget(node)) {
69797
- const symbol = getResolvedSymbol(node);
69798
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69799
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69800
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69801
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69802
- }
69803
- }
69804
- return;
69805
- case 281 /* ExportSpecifier */:
69806
- const exportDeclaration = node.parent.parent;
69807
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
69808
- const symbol = resolveEntityName(
69809
- node.propertyName || node.name,
69810
- 111551 /* Value */,
69811
- /*ignoreErrors*/
69812
- true,
69813
- /*dontResolveAlias*/
69814
- true
69815
- );
69816
- if (symbol && isParameterOrMutableLocalVariable(symbol)) {
69817
- symbol.lastAssignmentPos = Number.MAX_VALUE;
69818
- }
69822
+ if (node.kind === 80 /* Identifier */) {
69823
+ if (isAssignmentTarget(node)) {
69824
+ const symbol = getResolvedSymbol(node);
69825
+ if (isParameterOrCatchClauseVariable(symbol)) {
69826
+ symbol.isAssigned = true;
69819
69827
  }
69820
- return;
69821
- case 264 /* InterfaceDeclaration */:
69822
- case 265 /* TypeAliasDeclaration */:
69823
- case 266 /* EnumDeclaration */:
69824
- return;
69825
- }
69826
- if (isTypeNode(node)) {
69827
- return;
69828
- }
69829
- forEachChild(node, markNodeAssignments);
69830
- }
69831
- function extendAssignmentPosition(node, declaration) {
69832
- let pos = node.pos;
69833
- while (node && node.pos > declaration.pos) {
69834
- switch (node.kind) {
69835
- case 243 /* VariableStatement */:
69836
- case 244 /* ExpressionStatement */:
69837
- case 245 /* IfStatement */:
69838
- case 246 /* DoStatement */:
69839
- case 247 /* WhileStatement */:
69840
- case 248 /* ForStatement */:
69841
- case 249 /* ForInStatement */:
69842
- case 250 /* ForOfStatement */:
69843
- case 254 /* WithStatement */:
69844
- case 255 /* SwitchStatement */:
69845
- case 258 /* TryStatement */:
69846
- case 263 /* ClassDeclaration */:
69847
- pos = node.end;
69848
69828
  }
69849
- node = node.parent;
69829
+ } else {
69830
+ forEachChild(node, markNodeAssignments);
69850
69831
  }
69851
- return pos;
69852
69832
  }
69853
69833
  function isConstantVariable(symbol) {
69854
69834
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
69855
69835
  }
69856
- function isParameterOrMutableLocalVariable(symbol) {
69857
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
69858
- return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
69859
- }
69860
- function isMutableLocalVariableDeclaration(declaration) {
69861
- return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
69862
- }
69863
69836
  function parameterInitializerContainsUndefined(declaration) {
69864
69837
  const links = getNodeLinks(declaration);
69865
69838
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -70108,7 +70081,7 @@ ${lanes.join("\n")}
70108
70081
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
70109
70082
  const typeIsAutomatic = type === autoType || type === autoArrayType;
70110
70083
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
70111
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
70084
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
70112
70085
  flowContainer = getControlFlowContainer(flowContainer);
70113
70086
  }
70114
70087
  const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
@@ -71379,6 +71352,8 @@ ${lanes.join("\n")}
71379
71352
  case 286 /* JsxOpeningElement */:
71380
71353
  case 285 /* JsxSelfClosingElement */:
71381
71354
  return getContextualJsxElementAttributesType(parent2, contextFlags);
71355
+ case 301 /* ImportAttribute */:
71356
+ return getContextualImportAttributeType(parent2);
71382
71357
  }
71383
71358
  return void 0;
71384
71359
  }
@@ -71426,6 +71401,12 @@ ${lanes.join("\n")}
71426
71401
  }
71427
71402
  }
71428
71403
  }
71404
+ function getContextualImportAttributeType(node) {
71405
+ return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
71406
+ /*reportErrors*/
71407
+ false
71408
+ ), getNameFromImportAttribute(node));
71409
+ }
71429
71410
  function getContextualJsxElementAttributesType(node, contextFlags) {
71430
71411
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
71431
71412
  const index = findContextualNode(
@@ -83511,6 +83492,13 @@ ${lanes.join("\n")}
83511
83492
  var _a;
83512
83493
  const node = declaration.attributes;
83513
83494
  if (node) {
83495
+ const importAttributesType = getGlobalImportAttributesType(
83496
+ /*reportErrors*/
83497
+ true
83498
+ );
83499
+ if (importAttributesType !== emptyObjectType) {
83500
+ checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
83501
+ }
83514
83502
  const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
83515
83503
  const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
83516
83504
  const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
@@ -83530,6 +83518,9 @@ ${lanes.join("\n")}
83530
83518
  }
83531
83519
  }
83532
83520
  }
83521
+ function checkImportAttribute(node) {
83522
+ return getRegularTypeOfLiteralType(checkExpressionCached(node.value));
83523
+ }
83533
83524
  function checkImportDeclaration(node) {
83534
83525
  if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
83535
83526
  return;
@@ -84945,6 +84936,12 @@ ${lanes.join("\n")}
84945
84936
  if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
84946
84937
  return checkMetaPropertyKeyword(node.parent);
84947
84938
  }
84939
+ if (isImportAttributes(node)) {
84940
+ return getGlobalImportAttributesType(
84941
+ /*reportErrors*/
84942
+ false
84943
+ );
84944
+ }
84948
84945
  return errorType;
84949
84946
  }
84950
84947
  function getTypeOfAssignmentPattern(expr) {
@@ -160014,7 +160011,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160014
160011
  return isIdentifier(e) ? e : isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : void 0;
160015
160012
  }
160016
160013
  function tryGetGlobalSymbols() {
160017
- const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
160014
+ const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetImportAttributesCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
160018
160015
  return result === 1 /* Success */;
160019
160016
  }
160020
160017
  function tryGetConstructorCompletion() {
@@ -160482,6 +160479,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160482
160479
  }
160483
160480
  return 1 /* Success */;
160484
160481
  }
160482
+ function tryGetImportAttributesCompletionSymbols() {
160483
+ if (contextToken === void 0)
160484
+ return 0 /* Continue */;
160485
+ const importAttributes = contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */ ? tryCast(contextToken.parent, isImportAttributes) : void 0;
160486
+ if (importAttributes === void 0)
160487
+ return 0 /* Continue */;
160488
+ const existing = new Set(importAttributes.elements.map(getNameFromImportAttribute));
160489
+ symbols = filter(typeChecker.getTypeAtLocation(importAttributes).getApparentProperties(), (attr) => !existing.has(attr.escapedName));
160490
+ return 1 /* Success */;
160491
+ }
160485
160492
  function tryGetLocalNamedExportCompletionSymbols() {
160486
160493
  var _a;
160487
160494
  const namedExports = contextToken && (contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */) ? tryCast(contextToken.parent, isNamedExports) : void 0;
@@ -186334,6 +186341,7 @@ ${e.message}`;
186334
186341
  getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
186335
186342
  getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
186336
186343
  getNameForExportedSymbol: () => getNameForExportedSymbol,
186344
+ getNameFromImportAttribute: () => getNameFromImportAttribute,
186337
186345
  getNameFromIndexInfo: () => getNameFromIndexInfo,
186338
186346
  getNameFromPropertyName: () => getNameFromPropertyName,
186339
186347
  getNameOfAccessExpression: () => getNameOfAccessExpression,
@@ -186689,6 +186697,7 @@ ${e.message}`;
186689
186697
  isCaseKeyword: () => isCaseKeyword,
186690
186698
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
186691
186699
  isCatchClause: () => isCatchClause,
186700
+ isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
186692
186701
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
186693
186702
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
186694
186703
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -187090,6 +187099,7 @@ ${e.message}`;
187090
187099
  isPackedArrayLiteral: () => isPackedArrayLiteral,
187091
187100
  isParameter: () => isParameter,
187092
187101
  isParameterDeclaration: () => isParameterDeclaration,
187102
+ isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
187093
187103
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
187094
187104
  isParameterPropertyModifier: () => isParameterPropertyModifier,
187095
187105
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -188754,6 +188764,7 @@ ${e.message}`;
188754
188764
  getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
188755
188765
  getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
188756
188766
  getNameForExportedSymbol: () => getNameForExportedSymbol,
188767
+ getNameFromImportAttribute: () => getNameFromImportAttribute,
188757
188768
  getNameFromIndexInfo: () => getNameFromIndexInfo,
188758
188769
  getNameFromPropertyName: () => getNameFromPropertyName,
188759
188770
  getNameOfAccessExpression: () => getNameOfAccessExpression,
@@ -189109,6 +189120,7 @@ ${e.message}`;
189109
189120
  isCaseKeyword: () => isCaseKeyword,
189110
189121
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
189111
189122
  isCatchClause: () => isCatchClause,
189123
+ isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
189112
189124
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
189113
189125
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
189114
189126
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -189510,6 +189522,7 @@ ${e.message}`;
189510
189522
  isPackedArrayLiteral: () => isPackedArrayLiteral,
189511
189523
  isParameter: () => isParameter,
189512
189524
  isParameterDeclaration: () => isParameterDeclaration,
189525
+ isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
189513
189526
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
189514
189527
  isParameterPropertyModifier: () => isParameterPropertyModifier,
189515
189528
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -11129,7 +11129,7 @@ function Symbol4(flags, name) {
11129
11129
  this.exportSymbol = void 0;
11130
11130
  this.constEnumOnlyModule = void 0;
11131
11131
  this.isReferenced = void 0;
11132
- this.lastAssignmentPos = void 0;
11132
+ this.isAssigned = void 0;
11133
11133
  this.links = void 0;
11134
11134
  }
11135
11135
  function Type3(checker, flags) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-pr-56908-56",
5
+ "version": "5.4.0-pr-56034-9",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "11c87792dfbf34305c9e0e98914e57d2b4465504"
117
+ "gitHead": "3d7ec298514e9e6328f70e6f9aec65cfdfcc286e"
118
118
  }