@typescript-deploys/pr-build 5.5.0-pr-58025-3 → 5.5.0-pr-58065-2

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240401`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240403`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3924,7 +3924,6 @@ var commentPragmas = {
3924
3924
  kind: 4 /* MultiLine */
3925
3925
  }
3926
3926
  };
3927
- var _optionsType = [void 0][0];
3928
3927
 
3929
3928
  // src/compiler/sys.ts
3930
3929
  function generateDjb2Hash(data) {
@@ -33838,16 +33837,13 @@ var compileOnSaveCommandLineOption = {
33838
33837
  type: "boolean",
33839
33838
  defaultValueDescription: false
33840
33839
  };
33841
- function strongMap(input) {
33842
- return new Map(Object.entries(input));
33843
- }
33844
- var jsxOptionMap = strongMap({
33840
+ var jsxOptionMap = new Map(Object.entries({
33845
33841
  "preserve": 1 /* Preserve */,
33846
33842
  "react-native": 3 /* ReactNative */,
33847
33843
  "react": 2 /* React */,
33848
33844
  "react-jsx": 4 /* ReactJSX */,
33849
33845
  "react-jsxdev": 5 /* ReactJSXDev */
33850
- });
33846
+ }));
33851
33847
  var inverseJsxOptionMap = new Map(mapIterator(jsxOptionMap.entries(), ([key, value]) => ["" + value, key]));
33852
33848
  var libEntries = [
33853
33849
  // JavaScript only
@@ -33945,38 +33941,38 @@ var libMap = new Map(libEntries);
33945
33941
  var optionsForWatch = [
33946
33942
  {
33947
33943
  name: "watchFile",
33948
- type: strongMap({
33944
+ type: new Map(Object.entries({
33949
33945
  fixedpollinginterval: 0 /* FixedPollingInterval */,
33950
33946
  prioritypollinginterval: 1 /* PriorityPollingInterval */,
33951
33947
  dynamicprioritypolling: 2 /* DynamicPriorityPolling */,
33952
33948
  fixedchunksizepolling: 3 /* FixedChunkSizePolling */,
33953
33949
  usefsevents: 4 /* UseFsEvents */,
33954
33950
  usefseventsonparentdirectory: 5 /* UseFsEventsOnParentDirectory */
33955
- }),
33951
+ })),
33956
33952
  category: Diagnostics.Watch_and_Build_Modes,
33957
33953
  description: Diagnostics.Specify_how_the_TypeScript_watch_mode_works,
33958
33954
  defaultValueDescription: 4 /* UseFsEvents */
33959
33955
  },
33960
33956
  {
33961
33957
  name: "watchDirectory",
33962
- type: strongMap({
33958
+ type: new Map(Object.entries({
33963
33959
  usefsevents: 0 /* UseFsEvents */,
33964
33960
  fixedpollinginterval: 1 /* FixedPollingInterval */,
33965
33961
  dynamicprioritypolling: 2 /* DynamicPriorityPolling */,
33966
33962
  fixedchunksizepolling: 3 /* FixedChunkSizePolling */
33967
- }),
33963
+ })),
33968
33964
  category: Diagnostics.Watch_and_Build_Modes,
33969
33965
  description: Diagnostics.Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality,
33970
33966
  defaultValueDescription: 0 /* UseFsEvents */
33971
33967
  },
33972
33968
  {
33973
33969
  name: "fallbackPolling",
33974
- type: strongMap({
33970
+ type: new Map(Object.entries({
33975
33971
  fixedinterval: 0 /* FixedInterval */,
33976
33972
  priorityinterval: 1 /* PriorityInterval */,
33977
33973
  dynamicpriority: 2 /* DynamicPriority */,
33978
33974
  fixedchunksize: 3 /* FixedChunkSize */
33979
- }),
33975
+ })),
33980
33976
  category: Diagnostics.Watch_and_Build_Modes,
33981
33977
  description: Diagnostics.Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers,
33982
33978
  defaultValueDescription: 1 /* PriorityInterval */
@@ -34202,7 +34198,7 @@ var commonOptionsWithBuild = [
34202
34198
  var targetOptionDeclaration = {
34203
34199
  name: "target",
34204
34200
  shortName: "t",
34205
- type: strongMap({
34201
+ type: new Map(Object.entries({
34206
34202
  es3: 0 /* ES3 */,
34207
34203
  es5: 1 /* ES5 */,
34208
34204
  es6: 2 /* ES2015 */,
@@ -34215,7 +34211,7 @@ var targetOptionDeclaration = {
34215
34211
  es2021: 8 /* ES2021 */,
34216
34212
  es2022: 9 /* ES2022 */,
34217
34213
  esnext: 99 /* ESNext */
34218
- }),
34214
+ })),
34219
34215
  affectsSourceFile: true,
34220
34216
  affectsModuleResolution: true,
34221
34217
  affectsEmit: true,
@@ -34230,7 +34226,7 @@ var targetOptionDeclaration = {
34230
34226
  var moduleOptionDeclaration = {
34231
34227
  name: "module",
34232
34228
  shortName: "m",
34233
- type: strongMap({
34229
+ type: new Map(Object.entries({
34234
34230
  none: 0 /* None */,
34235
34231
  commonjs: 1 /* CommonJS */,
34236
34232
  amd: 2 /* AMD */,
@@ -34244,7 +34240,7 @@ var moduleOptionDeclaration = {
34244
34240
  node16: 100 /* Node16 */,
34245
34241
  nodenext: 199 /* NodeNext */,
34246
34242
  preserve: 200 /* Preserve */
34247
- }),
34243
+ })),
34248
34244
  affectsSourceFile: true,
34249
34245
  affectsModuleResolution: true,
34250
34246
  affectsEmit: true,
@@ -34463,11 +34459,11 @@ var commandOptionsWithoutBuild = [
34463
34459
  },
34464
34460
  {
34465
34461
  name: "importsNotUsedAsValues",
34466
- type: strongMap({
34462
+ type: new Map(Object.entries({
34467
34463
  remove: 0 /* Remove */,
34468
34464
  preserve: 1 /* Preserve */,
34469
34465
  error: 2 /* Error */
34470
- }),
34466
+ })),
34471
34467
  affectsEmit: true,
34472
34468
  affectsSemanticDiagnostics: true,
34473
34469
  affectsBuildInfo: true,
@@ -34675,7 +34671,7 @@ var commandOptionsWithoutBuild = [
34675
34671
  // Module Resolution
34676
34672
  {
34677
34673
  name: "moduleResolution",
34678
- type: strongMap({
34674
+ type: new Map(Object.entries({
34679
34675
  // N.B. The first entry specifies the value shown in `tsc --init`
34680
34676
  node10: 2 /* Node10 */,
34681
34677
  node: 2 /* Node10 */,
@@ -34683,7 +34679,7 @@ var commandOptionsWithoutBuild = [
34683
34679
  node16: 3 /* Node16 */,
34684
34680
  nodenext: 99 /* NodeNext */,
34685
34681
  bundler: 100 /* Bundler */
34686
- }),
34682
+ })),
34687
34683
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
34688
34684
  affectsSourceFile: true,
34689
34685
  affectsModuleResolution: true,
@@ -34979,10 +34975,10 @@ var commandOptionsWithoutBuild = [
34979
34975
  },
34980
34976
  {
34981
34977
  name: "newLine",
34982
- type: strongMap({
34978
+ type: new Map(Object.entries({
34983
34979
  crlf: 0 /* CarriageReturnLineFeed */,
34984
34980
  lf: 1 /* LineFeed */
34985
- }),
34981
+ })),
34986
34982
  affectsEmit: true,
34987
34983
  affectsBuildInfo: true,
34988
34984
  paramType: Diagnostics.NEWLINE,
@@ -35223,11 +35219,11 @@ var commandOptionsWithoutBuild = [
35223
35219
  },
35224
35220
  {
35225
35221
  name: "moduleDetection",
35226
- type: strongMap({
35222
+ type: new Map(Object.entries({
35227
35223
  auto: 2 /* Auto */,
35228
35224
  legacy: 1 /* Legacy */,
35229
35225
  force: 3 /* Force */
35230
- }),
35226
+ })),
35231
35227
  affectsSourceFile: true,
35232
35228
  affectsModuleResolution: true,
35233
35229
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
@@ -35599,10 +35595,7 @@ function getDiagnosticText(message, ...args) {
35599
35595
  return cast(createCompilerDiagnostic(message, ...args).messageText, isString);
35600
35596
  }
35601
35597
  function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend, extraFileExtensions) {
35602
- const typeConfig = hasTSFileExtension(configFileName) || hasJSFileExtension(configFileName) ? loadConfigFromDefaultType(
35603
- configFileName
35604
- ) : void 0;
35605
- const configFileText = typeConfig ? typeConfig.configText : tryReadFile(configFileName, (fileName) => host.readFile(fileName));
35598
+ const configFileText = tryReadFile(configFileName, (fileName) => host.readFile(fileName));
35606
35599
  if (!isString(configFileText)) {
35607
35600
  host.onUnRecoverableConfigFileDiagnostic(configFileText);
35608
35601
  return void 0;
@@ -35612,7 +35605,7 @@ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host,
35612
35605
  result.path = toPath(configFileName, cwd, createGetCanonicalFileName(host.useCaseSensitiveFileNames));
35613
35606
  result.resolvedPath = result.path;
35614
35607
  result.originalFileName = result.fileName;
35615
- const parsedResult = parseJsonSourceFileConfigFileContent(
35608
+ return parseJsonSourceFileConfigFileContent(
35616
35609
  result,
35617
35610
  host,
35618
35611
  getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd),
@@ -35624,64 +35617,6 @@ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host,
35624
35617
  extendedConfigCache,
35625
35618
  watchOptionsToExtend
35626
35619
  );
35627
- parsedResult.errors = concatenate(parsedResult.errors, typeConfig == null ? void 0 : typeConfig.errors);
35628
- return parsedResult;
35629
- }
35630
- function loadConfigFromDefaultType(configFileName) {
35631
- const program = createProgram({
35632
- rootNames: [configFileName],
35633
- options: {
35634
- strict: true,
35635
- exactOptionalPropertyTypes: true,
35636
- noEmit: true,
35637
- module: 199 /* NodeNext */,
35638
- target: 99 /* Latest */,
35639
- allowJs: true,
35640
- resolveJsonModule: true,
35641
- allowArbitraryExtensions: true,
35642
- lib: ["esnext"],
35643
- types: [],
35644
- moduleDetection: 3 /* Force */
35645
- }
35646
- // TODO: Use passed-in host object instead of sys
35647
- });
35648
- const file = Debug.checkDefined(program.getSourceFile(configFileName));
35649
- const checker = program.getTypeChecker();
35650
- const defaultMember = checker.tryGetMemberInModuleExports("default" /* Default */, file.symbol);
35651
- if (!defaultMember) {
35652
- return void 0;
35653
- }
35654
- const type = checker.getTypeOfSymbol(defaultMember);
35655
- const raw = convertTypeIntoRawConfig(checker, type);
35656
- return {
35657
- errors: program.getSemanticDiagnostics(file).slice(),
35658
- configText: JSON.stringify(raw)
35659
- };
35660
- }
35661
- function convertTypeIntoRawConfig(checker, type) {
35662
- return convertType(type);
35663
- function convertType(type2) {
35664
- if (type2.flags & 512 /* BooleanLiteral */) {
35665
- return type2.intrinsicName === "true" ? true : false;
35666
- }
35667
- if (type2.flags & 256 /* NumberLiteral */ || type2.flags & 128 /* StringLiteral */) {
35668
- return type2.value;
35669
- }
35670
- if (checker.isTupleType(type2)) {
35671
- const args = checker.getTypeArguments(type2);
35672
- return map(args, convertType);
35673
- }
35674
- if (type2.flags & 524288 /* Object */) {
35675
- const result = {};
35676
- const members = checker.getPropertiesOfType(type2);
35677
- for (const member of members) {
35678
- const name = symbolName(member);
35679
- result[name] = convertType(checker.getTypeOfSymbol(member));
35680
- }
35681
- return result;
35682
- }
35683
- return void 0;
35684
- }
35685
35620
  }
35686
35621
  function parseConfigFileTextToJson(fileName, jsonText) {
35687
35622
  const jsonSourceFile = parseJsonText(fileName, jsonText);
@@ -43540,7 +43475,7 @@ function createTypeChecker(host) {
43540
43475
  var requestedExternalEmitHelpers;
43541
43476
  var externalHelpersModule;
43542
43477
  var Symbol12 = objectAllocator.getSymbolConstructor();
43543
- var Type8 = objectAllocator.getTypeConstructor();
43478
+ var Type7 = objectAllocator.getTypeConstructor();
43544
43479
  var Signature5 = objectAllocator.getSignatureConstructor();
43545
43480
  var typeCount = 0;
43546
43481
  var symbolCount = 0;
@@ -47454,7 +47389,7 @@ function createTypeChecker(host) {
47454
47389
  }
47455
47390
  function createType(flags) {
47456
47391
  var _a;
47457
- const result = new Type8(checker, flags);
47392
+ const result = new Type7(checker, flags);
47458
47393
  typeCount++;
47459
47394
  result.id = typeCount;
47460
47395
  (_a = tracing) == null ? void 0 : _a.recordType(result);
@@ -47466,7 +47401,7 @@ function createTypeChecker(host) {
47466
47401
  return result;
47467
47402
  }
47468
47403
  function createOriginType(flags) {
47469
- return new Type8(checker, flags);
47404
+ return new Type7(checker, flags);
47470
47405
  }
47471
47406
  function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */, debugIntrinsicName) {
47472
47407
  checkIntrinsicName(intrinsicName, debugIntrinsicName);
@@ -49175,68 +49110,7 @@ function createTypeChecker(host) {
49175
49110
  /*skipUnionExpanding*/
49176
49111
  true
49177
49112
  )[0];
49178
- let cleanup;
49179
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
49180
- let pushFakeScope2 = function(kind2, addAll) {
49181
- Debug.assert(context.enclosingDeclaration);
49182
- let existingFakeScope;
49183
- if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
49184
- existingFakeScope = context.enclosingDeclaration;
49185
- } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
49186
- existingFakeScope = context.enclosingDeclaration.parent;
49187
- }
49188
- Debug.assertOptionalNode(existingFakeScope, isBlock);
49189
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
49190
- let newLocals;
49191
- addAll((name, symbol) => {
49192
- if (!locals.has(name)) {
49193
- newLocals = append(newLocals, name);
49194
- locals.set(name, symbol);
49195
- }
49196
- });
49197
- if (!newLocals)
49198
- return;
49199
- const oldCleanup = cleanup;
49200
- function undo() {
49201
- forEach(newLocals, (s) => locals.delete(s));
49202
- oldCleanup == null ? void 0 : oldCleanup();
49203
- }
49204
- if (existingFakeScope) {
49205
- cleanup = undo;
49206
- } else {
49207
- const fakeScope = parseNodeFactory.createBlock(emptyArray);
49208
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
49209
- fakeScope.locals = locals;
49210
- const saveEnclosingDeclaration = context.enclosingDeclaration;
49211
- setParent(fakeScope, saveEnclosingDeclaration);
49212
- context.enclosingDeclaration = fakeScope;
49213
- cleanup = () => {
49214
- context.enclosingDeclaration = saveEnclosingDeclaration;
49215
- undo();
49216
- };
49217
- }
49218
- };
49219
- var pushFakeScope = pushFakeScope2;
49220
- pushFakeScope2(
49221
- "params",
49222
- (add) => {
49223
- for (const param of expandedParams) {
49224
- add(param.escapedName, param);
49225
- }
49226
- }
49227
- );
49228
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
49229
- pushFakeScope2(
49230
- "typeParams",
49231
- (add) => {
49232
- for (const typeParam of signature.typeParameters ?? emptyArray) {
49233
- const typeParamName = typeParameterToName(typeParam, context).escapedText;
49234
- add(typeParamName, typeParam.symbol);
49235
- }
49236
- }
49237
- );
49238
- }
49239
- }
49113
+ const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters);
49240
49114
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
49241
49115
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
49242
49116
  if (thisParameter) {
@@ -49327,6 +49201,111 @@ function createTypeChecker(host) {
49327
49201
  cleanup == null ? void 0 : cleanup();
49328
49202
  return node;
49329
49203
  }
49204
+ function isNewScopeNode(node) {
49205
+ return isFunctionLike(node) || isJSDocSignature(node) || isMappedTypeNode(node);
49206
+ }
49207
+ function getTypeParametersInScope(node) {
49208
+ return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).typeParameters : isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
49209
+ }
49210
+ function getParametersInScope(node) {
49211
+ return isFunctionLike(node) || isJSDocSignature(node) ? getExpandedParameters(
49212
+ getSignatureFromDeclaration(node),
49213
+ /*skipUnionExpanding*/
49214
+ true
49215
+ )[0] : void 0;
49216
+ }
49217
+ function enterNewScope(context, declaration, expandedParams, typeParameters) {
49218
+ let cleanup;
49219
+ if (context.enclosingDeclaration && declaration && declaration !== context.enclosingDeclaration && !isInJSFile(declaration) && (some(expandedParams) || some(typeParameters))) {
49220
+ let pushFakeScope2 = function(kind, addAll) {
49221
+ Debug.assert(context.enclosingDeclaration);
49222
+ let existingFakeScope;
49223
+ if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind) {
49224
+ existingFakeScope = context.enclosingDeclaration;
49225
+ } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind) {
49226
+ existingFakeScope = context.enclosingDeclaration.parent;
49227
+ }
49228
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
49229
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
49230
+ let newLocals;
49231
+ addAll((name, symbol) => {
49232
+ if (!locals.has(name)) {
49233
+ newLocals = append(newLocals, name);
49234
+ locals.set(name, symbol);
49235
+ }
49236
+ });
49237
+ if (!newLocals)
49238
+ return;
49239
+ const oldCleanup = cleanup;
49240
+ function undo() {
49241
+ forEach(newLocals, (s) => locals.delete(s));
49242
+ oldCleanup == null ? void 0 : oldCleanup();
49243
+ }
49244
+ if (existingFakeScope) {
49245
+ cleanup = undo;
49246
+ } else {
49247
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
49248
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind;
49249
+ fakeScope.locals = locals;
49250
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
49251
+ setParent(fakeScope, saveEnclosingDeclaration);
49252
+ context.enclosingDeclaration = fakeScope;
49253
+ cleanup = () => {
49254
+ context.enclosingDeclaration = saveEnclosingDeclaration;
49255
+ undo();
49256
+ };
49257
+ }
49258
+ };
49259
+ var pushFakeScope = pushFakeScope2;
49260
+ pushFakeScope2(
49261
+ "params",
49262
+ (add) => {
49263
+ for (const param of expandedParams ?? emptyArray) {
49264
+ if (!forEach(param.declarations, (d) => {
49265
+ if (isParameter(d) && isBindingPattern(d.name)) {
49266
+ bindPattern(d.name);
49267
+ return true;
49268
+ }
49269
+ return void 0;
49270
+ function bindPattern(p) {
49271
+ forEach(p.elements, (e) => {
49272
+ switch (e.kind) {
49273
+ case 232 /* OmittedExpression */:
49274
+ return;
49275
+ case 208 /* BindingElement */:
49276
+ return bindElement(e);
49277
+ default:
49278
+ return Debug.assertNever(e);
49279
+ }
49280
+ });
49281
+ }
49282
+ function bindElement(e) {
49283
+ if (isBindingPattern(e.name)) {
49284
+ return bindPattern(e.name);
49285
+ }
49286
+ const symbol = getSymbolOfDeclaration(e);
49287
+ add(symbol.escapedName, symbol);
49288
+ }
49289
+ })) {
49290
+ add(param.escapedName, param);
49291
+ }
49292
+ }
49293
+ }
49294
+ );
49295
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
49296
+ pushFakeScope2(
49297
+ "typeParams",
49298
+ (add) => {
49299
+ for (const typeParam of typeParameters ?? emptyArray) {
49300
+ const typeParamName = typeParameterToName(typeParam, context).escapedText;
49301
+ add(typeParamName, typeParam.symbol);
49302
+ }
49303
+ }
49304
+ );
49305
+ }
49306
+ return cleanup;
49307
+ }
49308
+ }
49330
49309
  function tryGetThisParameterDeclaration(signature, context) {
49331
49310
  if (signature.thisParameter) {
49332
49311
  return symbolToParameterDeclaration(signature.thisParameter, context);
@@ -49945,6 +49924,9 @@ function createTypeChecker(host) {
49945
49924
  if (initial.typeParameterSymbolList) {
49946
49925
  initial.typeParameterSymbolList = new Set(initial.typeParameterSymbolList);
49947
49926
  }
49927
+ if (initial.typeParameterNamesByTextNextNameCount) {
49928
+ initial.typeParameterNamesByTextNextNameCount = new Map(initial.typeParameterNamesByTextNextNameCount);
49929
+ }
49948
49930
  initial.tracker = new SymbolTrackerImpl(initial, initial.tracker.inner, initial.tracker.moduleResolverHost);
49949
49931
  return initial;
49950
49932
  }
@@ -50077,6 +50059,22 @@ function createTypeChecker(host) {
50077
50059
  }
50078
50060
  return transformed === existing ? setTextRange(factory.cloneNode(existing), existing) : transformed;
50079
50061
  function visitExistingNodeTreeSymbols(node) {
50062
+ const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
50063
+ const result = visitExistingNodeTreeSymbolsWorker(node);
50064
+ onExitNewScope == null ? void 0 : onExitNewScope();
50065
+ return result;
50066
+ }
50067
+ function onEnterNewScope(node) {
50068
+ const oldContex = context;
50069
+ context = cloneNodeBuilderContext(context);
50070
+ const cleanup = enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
50071
+ return onExitNewScope;
50072
+ function onExitNewScope() {
50073
+ cleanup == null ? void 0 : cleanup();
50074
+ context = oldContex;
50075
+ }
50076
+ }
50077
+ function visitExistingNodeTreeSymbolsWorker(node) {
50080
50078
  if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
50081
50079
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
50082
50080
  }
@@ -50227,6 +50225,21 @@ function createTypeChecker(host) {
50227
50225
  setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
50228
50226
  return clone;
50229
50227
  }
50228
+ if (isConditionalTypeNode(node)) {
50229
+ const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode);
50230
+ const disposeScope = onEnterNewScope(node);
50231
+ const extendType = visitNode(node.extendsType, visitExistingNodeTreeSymbols, isTypeNode);
50232
+ const trueType2 = visitNode(node.trueType, visitExistingNodeTreeSymbols, isTypeNode);
50233
+ disposeScope();
50234
+ const falseType2 = visitNode(node.falseType, visitExistingNodeTreeSymbols, isTypeNode);
50235
+ return factory.updateConditionalTypeNode(
50236
+ node,
50237
+ checkType,
50238
+ extendType,
50239
+ trueType2,
50240
+ falseType2
50241
+ );
50242
+ }
50230
50243
  return visitEachChild(
50231
50244
  node,
50232
50245
  visitExistingNodeTreeSymbols,
@@ -63442,6 +63455,9 @@ function createTypeChecker(host) {
63442
63455
  const resolved = resolveStructuredTypeMembers(type);
63443
63456
  return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 && resolved.properties.length > 0 && every(resolved.properties, (p) => !!(p.flags & 16777216 /* Optional */));
63444
63457
  }
63458
+ if (type.flags & 33554432 /* Substitution */) {
63459
+ return isWeakType(type.baseType);
63460
+ }
63445
63461
  if (type.flags & 2097152 /* Intersection */) {
63446
63462
  return every(type.types, isWeakType);
63447
63463
  }
@@ -70410,7 +70426,11 @@ function createTypeChecker(host) {
70410
70426
  if (getPropertyOfObjectType(targetType, name) || getApplicableIndexInfoForName(targetType, name) || isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) || isComparingJsxAttributes && isHyphenatedJsxName(name)) {
70411
70427
  return true;
70412
70428
  }
70413
- } else if (targetType.flags & 3145728 /* UnionOrIntersection */ && isExcessPropertyCheckTarget(targetType)) {
70429
+ }
70430
+ if (targetType.flags & 33554432 /* Substitution */) {
70431
+ return isKnownProperty(targetType.baseType, name, isComparingJsxAttributes);
70432
+ }
70433
+ if (targetType.flags & 3145728 /* UnionOrIntersection */ && isExcessPropertyCheckTarget(targetType)) {
70414
70434
  for (const t of targetType.types) {
70415
70435
  if (isKnownProperty(t, name, isComparingJsxAttributes)) {
70416
70436
  return true;
@@ -70420,7 +70440,7 @@ function createTypeChecker(host) {
70420
70440
  return false;
70421
70441
  }
70422
70442
  function isExcessPropertyCheckTarget(type) {
70423
- return !!(type.flags & 524288 /* Object */ && !(getObjectFlags(type) & 512 /* ObjectLiteralPatternWithComputedProperties */) || type.flags & 67108864 /* NonPrimitive */ || type.flags & 1048576 /* Union */ && some(type.types, isExcessPropertyCheckTarget) || type.flags & 2097152 /* Intersection */ && every(type.types, isExcessPropertyCheckTarget));
70443
+ return !!(type.flags & 524288 /* Object */ && !(getObjectFlags(type) & 512 /* ObjectLiteralPatternWithComputedProperties */) || type.flags & 67108864 /* NonPrimitive */ || type.flags & 33554432 /* Substitution */ && isExcessPropertyCheckTarget(type.baseType) || type.flags & 1048576 /* Union */ && some(type.types, isExcessPropertyCheckTarget) || type.flags & 2097152 /* Intersection */ && every(type.types, isExcessPropertyCheckTarget));
70424
70444
  }
70425
70445
  function checkJsxExpression(node, checkMode) {
70426
70446
  checkGrammarJsxExpression(node);
@@ -74561,17 +74581,18 @@ function createTypeChecker(host) {
74561
74581
  const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || { flags: 2 /* Start */ };
74562
74582
  const trueCondition = {
74563
74583
  flags: 32 /* TrueCondition */,
74564
- node: expr,
74565
- antecedent
74584
+ antecedent,
74585
+ node: expr
74566
74586
  };
74567
74587
  const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
74568
74588
  if (trueType2 === initType)
74569
74589
  return void 0;
74570
74590
  const falseCondition = {
74571
- ...trueCondition,
74572
- flags: 64 /* FalseCondition */
74591
+ flags: 64 /* FalseCondition */,
74592
+ antecedent,
74593
+ node: expr
74573
74594
  };
74574
- const falseSubtype = getFlowTypeOfReference(param.name, trueType2, trueType2, func, falseCondition);
74595
+ const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
74575
74596
  return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
74576
74597
  }
74577
74598
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
@@ -117193,6 +117214,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117193
117214
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
117194
117215
  isSourceOfProjectReferenceRedirect,
117195
117216
  getRedirectReferenceForResolutionFromSourceOfProject,
117217
+ getRedirectReferenceForResolution,
117196
117218
  emitBuildInfo,
117197
117219
  fileExists,
117198
117220
  readFile,
@@ -122108,7 +122130,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122108
122130
  getResolutionWithResolvedFileName,
122109
122131
  deferWatchingNonRelativeResolution,
122110
122132
  shouldRetryResolution,
122111
- logChanges
122133
+ logChanges,
122134
+ canWatchFailedLookups
122112
122135
  }) {
122113
122136
  const path = resolutionHost.toPath(containingFile);
122114
122137
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
@@ -122131,7 +122154,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122131
122154
  }
122132
122155
  resolutionsInFile.set(name, mode, resolution);
122133
122156
  if (resolution !== existingResolution) {
122134
- watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
122157
+ watchFailedLookupLocationsOfExternalModuleResolutions(
122158
+ name,
122159
+ resolution,
122160
+ path,
122161
+ getResolutionWithResolvedFileName,
122162
+ deferWatchingNonRelativeResolution,
122163
+ (resolution2) => canWatchFailedLookups(resolution2, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options, containingSourceFile)
122164
+ );
122135
122165
  if (existingResolution) {
122136
122166
  stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
122137
122167
  }
@@ -122210,7 +122240,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122210
122240
  ),
122211
122241
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
122212
122242
  shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
122213
- deferWatchingNonRelativeResolution: false
122243
+ deferWatchingNonRelativeResolution: false,
122244
+ canWatchFailedLookups: canWatchFailedLookupsOfTypeReferencedDirective
122214
122245
  });
122215
122246
  }
122216
122247
  function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
@@ -122232,8 +122263,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122232
122263
  getResolutionWithResolvedFileName: getResolvedModule,
122233
122264
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
122234
122265
  logChanges: logChangesWhenResolvingModule,
122235
- deferWatchingNonRelativeResolution: true
122266
+ deferWatchingNonRelativeResolution: true,
122236
122267
  // Defer non relative resolution watch because we could be using ambient modules
122268
+ canWatchFailedLookups: canWatchFailedLookupsOfResolvedModule
122237
122269
  });
122238
122270
  }
122239
122271
  function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
@@ -122249,7 +122281,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122249
122281
  path,
122250
122282
  getResolvedModule,
122251
122283
  /*deferWatchingNonRelativeResolution*/
122252
- false
122284
+ false,
122285
+ canWatchFailedLookupsOfResolvedLibrary
122253
122286
  );
122254
122287
  resolvedLibraries.set(libFileName, resolution);
122255
122288
  if (existingResolution) {
@@ -122296,16 +122329,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122296
122329
  function isNodeModulesAtTypesDirectory(dirPath) {
122297
122330
  return endsWith(dirPath, "/node_modules/@types");
122298
122331
  }
122299
- function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
122300
- var _a;
122332
+ function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution, canWatchFailedLookups) {
122333
+ var _a, _b;
122301
122334
  if (resolution.refCount) {
122302
122335
  resolution.refCount++;
122303
122336
  Debug.assertIsDefined(resolution.files);
122304
122337
  } else {
122305
122338
  resolution.refCount = 1;
122306
122339
  Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
122340
+ if (((_b = resolution.failedLookupLocations) == null ? void 0 : _b.length) && canWatchFailedLookups(resolution))
122341
+ resolution.canWatchFailedLookups = true;
122307
122342
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
122308
- watchFailedLookupLocationOfResolution(resolution);
122343
+ watchFailedLookupLocationAndAffectedLocationsOfResolution(resolution);
122309
122344
  } else {
122310
122345
  nonRelativeExternalModuleResolutions.add(name, resolution);
122311
122346
  }
@@ -122341,15 +122376,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122341
122376
  }
122342
122377
  return setAtRoot;
122343
122378
  }
122344
- function watchFailedLookupLocationOfResolution(resolution) {
122379
+ function watchFailedLookupLocationAndAffectedLocationsOfResolution(resolution) {
122345
122380
  Debug.assert(!!resolution.refCount);
122346
122381
  const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
122347
122382
  if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult)
122348
122383
  return;
122349
- if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult)
122384
+ const addToFailedLookup = resolution.canWatchFailedLookups || alternateResult;
122385
+ if (addToFailedLookup)
122350
122386
  resolutionsWithFailedLookups.add(resolution);
122351
122387
  let setAtRoot = false;
122352
- if (failedLookupLocations) {
122388
+ if (resolution.canWatchFailedLookups) {
122353
122389
  for (const failedLookupLocation of failedLookupLocations) {
122354
122390
  setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
122355
122391
  }
@@ -122364,7 +122400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122364
122400
  true
122365
122401
  );
122366
122402
  }
122367
- watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
122403
+ watchAffectingLocationsOfResolution(resolution, !addToFailedLookup);
122368
122404
  }
122369
122405
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
122370
122406
  Debug.assert(!!resolution.refCount);
@@ -122451,7 +122487,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122451
122487
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122452
122488
  const program = resolutionHost.getCurrentProgram();
122453
122489
  if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
122454
- resolutions.forEach(watchFailedLookupLocationOfResolution);
122490
+ resolutions.forEach(watchFailedLookupLocationAndAffectedLocationsOfResolution);
122455
122491
  } else {
122456
122492
  resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
122457
122493
  resolution,
@@ -122502,10 +122538,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122502
122538
  if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
122503
122539
  resolvedFileToResolution.delete(key);
122504
122540
  }
122505
- const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
122541
+ const { canWatchFailedLookups, failedLookupLocations, affectingLocations, alternateResult } = resolution;
122506
122542
  if (resolutionsWithFailedLookups.delete(resolution)) {
122507
122543
  let removeAtRoot = false;
122508
- if (failedLookupLocations) {
122544
+ if (canWatchFailedLookups) {
122509
122545
  for (const failedLookupLocation of failedLookupLocations) {
122510
122546
  removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
122511
122547
  }
@@ -122678,7 +122714,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122678
122714
  return true;
122679
122715
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
122680
122716
  return false;
122681
- return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.alternateResult));
122717
+ return resolution.canWatchFailedLookups && ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.alternateResult));
122682
122718
  }
122683
122719
  function isInvalidatedFailedLookup(locationPath) {
122684
122720
  return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
@@ -122741,6 +122777,16 @@ function resolutionIsSymlink(resolution) {
122741
122777
  var _a, _b;
122742
122778
  return !!(((_a = resolution.resolvedModule) == null ? void 0 : _a.originalPath) || ((_b = resolution.resolvedTypeReferenceDirective) == null ? void 0 : _b.originalPath));
122743
122779
  }
122780
+ function canWatchFailedLookupsOfResolvedModule(resolution, optionsForFile, file) {
122781
+ var _a;
122782
+ return !resolution.resolvedModule || !!resolution.alternateResult || !!((_a = resolution.resolutionDiagnostics) == null ? void 0 : _a.length) || !!getResolutionDiagnostic(optionsForFile, resolution.resolvedModule, file);
122783
+ }
122784
+ function canWatchFailedLookupsOfTypeReferencedDirective(resolution) {
122785
+ return !resolution.resolvedTypeReferenceDirective;
122786
+ }
122787
+ function canWatchFailedLookupsOfResolvedLibrary(resolution) {
122788
+ return !resolution.resolvedModule;
122789
+ }
122744
122790
 
122745
122791
  // src/compiler/watch.ts
122746
122792
  var sysFormatDiagnosticsHost = sys ? {