typescript 4.9.0-dev.20220830 → 4.9.0-dev.20220902

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/README.md CHANGED
@@ -46,59 +46,6 @@ with any additional questions or comments.
46
46
  * [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
47
47
  * [Homepage](https://www.typescriptlang.org/)
48
48
 
49
- ## Building
50
-
51
- In order to build the TypeScript compiler, ensure that you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed.
52
-
53
- Clone a copy of the repo:
54
-
55
- ```bash
56
- git clone https://github.com/microsoft/TypeScript.git
57
- ```
58
-
59
- Change to the TypeScript directory:
60
-
61
- ```bash
62
- cd TypeScript
63
- ```
64
-
65
- Install [Gulp](https://gulpjs.com/) tools and dev dependencies:
66
-
67
- ```bash
68
- npm install -g gulp
69
- npm ci
70
- ```
71
-
72
- Use one of the following to build and test:
73
-
74
- ```
75
- gulp local # Build the compiler into built/local.
76
- gulp clean # Delete the built compiler.
77
- gulp LKG # Replace the last known good with the built one.
78
- # Bootstrapping step to be executed when the built compiler reaches a stable state.
79
- gulp tests # Build the test infrastructure using the built compiler.
80
- gulp runtests # Run tests using the built compiler and test infrastructure.
81
- # You can override the specific suite runner used or specify a test for this command.
82
- # Use --tests=<testPath> for a specific test and/or --runner=<runnerName> for a specific suite.
83
- # Valid runners include conformance, compiler, fourslash, project, user, and docker
84
- # The user and docker runners are extended test suite runners - the user runner
85
- # works on disk in the tests/cases/user directory, while the docker runner works in containers.
86
- # You'll need to have the docker executable in your system path for the docker runner to work.
87
- gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
88
- # core count by default. Use --workers=<number> to adjust this.
89
- gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
90
- gulp lint # Runs eslint on the TypeScript source.
91
- gulp help # List the above commands.
92
- ```
93
-
94
-
95
- ## Usage
96
-
97
- ```bash
98
- node built/local/tsc.js hello.ts
99
- ```
100
-
101
-
102
49
  ## Roadmap
103
50
 
104
51
  For details on our planned features and future direction please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -36780,7 +36780,7 @@ var ts;
36780
36780
  var _a, _b;
36781
36781
  if (path === undefined)
36782
36782
  return path;
36783
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
36783
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
36784
36784
  }
36785
36785
  function combineDirectoryPath(root, dir) {
36786
36786
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -36795,7 +36795,7 @@ var ts;
36795
36795
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
36796
36796
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
36797
36797
  && finalPath.indexOf("/node_modules/") === -1
36798
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
36798
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
36799
36799
  var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
36800
36800
  var commonSourceDirGuesses = [];
36801
36801
  if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
@@ -36825,7 +36825,7 @@ var ts;
36825
36825
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
36826
36826
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
36827
36827
  var candidateDir = candidateDirectories_1[_e];
36828
- if (ts.startsWith(finalPath, candidateDir)) {
36828
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
36829
36829
  var pathFragment = finalPath.slice(candidateDir.length + 1);
36830
36830
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
36831
36831
  var jsAndDtsExtensions = [".mjs", ".cjs", ".js", ".json", ".d.mts", ".d.cts", ".d.ts"];
@@ -44844,7 +44844,7 @@ var ts;
44844
44844
  }
44845
44845
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
44846
44846
  if (ts.isBindingElement(visited)) {
44847
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
44847
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
44848
44848
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, undefined, visited.propertyName, undefined);
44849
44849
  }
44850
44850
  else {
@@ -51995,7 +51995,7 @@ var ts;
51995
51995
  return includes & 8388608 ? wildcardType : anyType;
51996
51996
  }
51997
51997
  if (!strictNullChecks && includes & 98304) {
51998
- return includes & 32768 ? undefinedType : nullType;
51998
+ return includes & 16777216 ? neverType : includes & 32768 ? undefinedType : nullType;
51999
51999
  }
52000
52000
  if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
52001
52001
  includes & 8 && includes & 256 ||
@@ -52630,7 +52630,7 @@ var ts;
52630
52630
  type;
52631
52631
  }
52632
52632
  function distributeIndexOverObjectType(objectType, indexType, writing) {
52633
- if (objectType.flags & 3145728) {
52633
+ if (objectType.flags & 1048576 || objectType.flags & 2097152 && !shouldDeferIndexType(objectType)) {
52634
52634
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
52635
52635
  return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types);
52636
52636
  }
@@ -54762,7 +54762,7 @@ var ts;
54762
54762
  if (reduced !== type) {
54763
54763
  return reduced;
54764
54764
  }
54765
- if (type.flags & 2097152) {
54765
+ if (type.flags & 2097152 && ts.some(type.types, isEmptyAnonymousObjectType)) {
54766
54766
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
54767
54767
  if (normalizedTypes !== type.types) {
54768
54768
  return getIntersectionType(normalizedTypes);
@@ -60174,7 +60174,7 @@ var ts;
60174
60174
  var narrowedPropType = narrowType(propType);
60175
60175
  return filterType(type, function (t) {
60176
60176
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
60177
- return !(narrowedPropType.flags & 131072) && isTypeComparableTo(narrowedPropType, discriminantType);
60177
+ return !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType);
60178
60178
  });
60179
60179
  }
60180
60180
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -60381,11 +60381,18 @@ var ts;
60381
60381
  }
60382
60382
  var target = getReferenceCandidate(typeOfExpr.expression);
60383
60383
  if (!isMatchingReference(reference, target)) {
60384
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
60385
+ if (propertyAccess) {
60386
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
60387
+ }
60384
60388
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
60385
60389
  return getAdjustedTypeWithFacts(type, 2097152);
60386
60390
  }
60387
60391
  return type;
60388
60392
  }
60393
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
60394
+ }
60395
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
60389
60396
  return assumeTrue ?
60390
60397
  narrowTypeByTypeName(type, literal.text) :
60391
60398
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768);
@@ -62693,6 +62700,7 @@ var ts;
62693
62700
  }
62694
62701
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
62695
62702
  var attributes = openingLikeElement.attributes;
62703
+ var attributesType = getContextualType(attributes, 0);
62696
62704
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
62697
62705
  var attributesTable = ts.createSymbolTable();
62698
62706
  var spread = emptyJsxObjectType;
@@ -62720,6 +62728,12 @@ var ts;
62720
62728
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
62721
62729
  explicitlySpecifyChildrenAttribute = true;
62722
62730
  }
62731
+ if (attributesType) {
62732
+ var prop = getPropertyOfType(attributesType, member.escapedName);
62733
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
62734
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
62735
+ }
62736
+ }
62723
62737
  }
62724
62738
  else {
62725
62739
  ts.Debug.assert(attributeDecl.kind === 289);
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -44881,7 +44881,7 @@ var ts;
44881
44881
  var _a, _b;
44882
44882
  if (path === undefined)
44883
44883
  return path;
44884
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44884
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44885
44885
  }
44886
44886
  function combineDirectoryPath(root, dir) {
44887
44887
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44901,7 +44901,7 @@ var ts;
44901
44901
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44902
44902
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44903
44903
  && finalPath.indexOf("/node_modules/") === -1
44904
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44904
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44905
44905
  // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
44906
44906
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44907
44907
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44957,7 +44957,7 @@ var ts;
44957
44957
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44958
44958
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44959
44959
  var candidateDir = candidateDirectories_1[_e];
44960
- if (ts.startsWith(finalPath, candidateDir)) {
44960
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44961
44961
  // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
44962
44962
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44963
44963
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -54278,7 +54278,7 @@ var ts;
54278
54278
  }
54279
54279
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
54280
54280
  if (ts.isBindingElement(visited)) {
54281
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
54281
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
54282
54282
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
54283
54283
  /* propertyName*/ undefined, visited.propertyName,
54284
54284
  /*initializer*/ undefined);
@@ -62527,7 +62527,7 @@ var ts;
62527
62527
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62528
62528
  }
62529
62529
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62530
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62530
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62531
62531
  }
62532
62532
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62533
62533
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -63217,7 +63217,7 @@ var ts;
63217
63217
  // (T | U)[K] -> T[K] | U[K] (reading)
63218
63218
  // (T | U)[K] -> T[K] & U[K] (writing)
63219
63219
  // (T & U)[K] -> T[K] & U[K]
63220
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
63220
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
63221
63221
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
63222
63222
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
63223
63223
  }
@@ -65621,7 +65621,7 @@ var ts;
65621
65621
  if (reduced !== type) {
65622
65622
  return reduced;
65623
65623
  }
65624
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65624
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65625
65625
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65626
65626
  if (normalizedTypes !== type.types) {
65627
65627
  return getIntersectionType(normalizedTypes);
@@ -71919,7 +71919,7 @@ var ts;
71919
71919
  var narrowedPropType = narrowType(propType);
71920
71920
  return filterType(type, function (t) {
71921
71921
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71922
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71922
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71923
71923
  });
71924
71924
  }
71925
71925
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -72140,11 +72140,18 @@ var ts;
72140
72140
  }
72141
72141
  var target = getReferenceCandidate(typeOfExpr.expression);
72142
72142
  if (!isMatchingReference(reference, target)) {
72143
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
72144
+ if (propertyAccess) {
72145
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
72146
+ }
72143
72147
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
72144
72148
  return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
72145
72149
  }
72146
72150
  return type;
72147
72151
  }
72152
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
72153
+ }
72154
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
72148
72155
  return assumeTrue ?
72149
72156
  narrowTypeByTypeName(type, literal.text) :
72150
72157
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
@@ -74917,6 +74924,7 @@ var ts;
74917
74924
  */
74918
74925
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
74919
74926
  var attributes = openingLikeElement.attributes;
74927
+ var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
74920
74928
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
74921
74929
  var attributesTable = ts.createSymbolTable();
74922
74930
  var spread = emptyJsxObjectType;
@@ -74944,6 +74952,12 @@ var ts;
74944
74952
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
74945
74953
  explicitlySpecifyChildrenAttribute = true;
74946
74954
  }
74955
+ if (attributesType) {
74956
+ var prop = getPropertyOfType(attributesType, member.escapedName);
74957
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
74958
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
74959
+ }
74960
+ }
74947
74961
  }
74948
74962
  else {
74949
74963
  ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
@@ -172211,13 +172225,13 @@ var ts;
172211
172225
  return __generator(this, function (_a) {
172212
172226
  switch (_a.label) {
172213
172227
  case 0:
172214
- ts.Debug.assertIsDefined(host.importServicePlugin);
172228
+ ts.Debug.assertIsDefined(host.importPlugin);
172215
172229
  resolvedPath = ts.combinePaths(initialDir, "node_modules");
172216
172230
  log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
172217
172231
  _a.label = 1;
172218
172232
  case 1:
172219
172233
  _a.trys.push([1, 3, , 4]);
172220
- return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
172234
+ return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
172221
172235
  case 2:
172222
172236
  result = _a.sent();
172223
172237
  return [3 /*break*/, 4];
@@ -173296,7 +173310,7 @@ var ts;
173296
173310
  };
173297
173311
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
173298
173312
  var host = this.projectService.host;
173299
- if (!host.require && !host.importServicePlugin) {
173313
+ if (!host.require && !host.importPlugin) {
173300
173314
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
173301
173315
  return;
173302
173316
  }
@@ -173353,7 +173367,7 @@ var ts;
173353
173367
  return __generator(this, function (_a) {
173354
173368
  switch (_a.label) {
173355
173369
  case 0:
173356
- ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
173370
+ ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
173357
173371
  log = function (message) { return _this.projectService.logger.info(message); };
173358
173372
  logError = function (message) {
173359
173373
  (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
@@ -174054,7 +174068,7 @@ var ts;
174054
174068
  /*@internal*/
174055
174069
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
174056
174070
  var host = this.projectService.host;
174057
- if (!host.require && !host.importServicePlugin) {
174071
+ if (!host.require && !host.importPlugin) {
174058
174072
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
174059
174073
  return;
174060
174074
  }
@@ -177498,7 +177512,7 @@ var ts;
177498
177512
  /*@internal*/
177499
177513
  ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
177500
177514
  var _a;
177501
- if (!this.host.importServicePlugin && !this.host.require) {
177515
+ if (!this.host.importPlugin && !this.host.require) {
177502
177516
  this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
177503
177517
  return;
177504
177518
  }
@@ -177508,7 +177522,7 @@ var ts;
177508
177522
  return;
177509
177523
  }
177510
177524
  // If the host supports dynamic import, begin enabling the plugin asynchronously.
177511
- if (this.host.importServicePlugin) {
177525
+ if (this.host.importPlugin) {
177512
177526
  var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
177513
177527
  (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
177514
177528
  var promises = this.pendingPluginEnablements.get(project);
@@ -181807,7 +181821,7 @@ var ts;
181807
181821
  setImmediate: function (x) { return setTimeout(x, 0); },
181808
181822
  clearImmediate: function (handle) { return clearTimeout(handle); },
181809
181823
  /* eslint-enable no-restricted-globals */
181810
- importServicePlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181824
+ importPlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181811
181825
  var packageRoot, packageJson, packageJsonResponse, e_1, browser, scriptPath, module_1, e_2;
181812
181826
  return __generator(this, function (_a) {
181813
181827
  switch (_a.label) {
@@ -7044,7 +7044,6 @@ declare namespace ts.server {
7044
7044
  gc?(): void;
7045
7045
  trace?(s: string): void;
7046
7046
  require?(initialPath: string, moduleName: string): ModuleImportResult;
7047
- importServicePlugin?(root: string, moduleName: string): Promise<ModuleImportResult>;
7048
7047
  }
7049
7048
  }
7050
7049
  declare namespace ts.server {
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -44880,7 +44880,7 @@ var ts;
44880
44880
  var _a, _b;
44881
44881
  if (path === undefined)
44882
44882
  return path;
44883
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44883
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44884
44884
  }
44885
44885
  function combineDirectoryPath(root, dir) {
44886
44886
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44900,7 +44900,7 @@ var ts;
44900
44900
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44901
44901
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44902
44902
  && finalPath.indexOf("/node_modules/") === -1
44903
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44903
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44904
44904
  // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
44905
44905
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44906
44906
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44956,7 +44956,7 @@ var ts;
44956
44956
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44957
44957
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44958
44958
  var candidateDir = candidateDirectories_1[_e];
44959
- if (ts.startsWith(finalPath, candidateDir)) {
44959
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44960
44960
  // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
44961
44961
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44962
44962
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -54277,7 +54277,7 @@ var ts;
54277
54277
  }
54278
54278
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
54279
54279
  if (ts.isBindingElement(visited)) {
54280
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
54280
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
54281
54281
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
54282
54282
  /* propertyName*/ undefined, visited.propertyName,
54283
54283
  /*initializer*/ undefined);
@@ -62526,7 +62526,7 @@ var ts;
62526
62526
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62527
62527
  }
62528
62528
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62529
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62529
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62530
62530
  }
62531
62531
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62532
62532
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -63216,7 +63216,7 @@ var ts;
63216
63216
  // (T | U)[K] -> T[K] | U[K] (reading)
63217
63217
  // (T | U)[K] -> T[K] & U[K] (writing)
63218
63218
  // (T & U)[K] -> T[K] & U[K]
63219
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
63219
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
63220
63220
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
63221
63221
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
63222
63222
  }
@@ -65620,7 +65620,7 @@ var ts;
65620
65620
  if (reduced !== type) {
65621
65621
  return reduced;
65622
65622
  }
65623
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65623
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65624
65624
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65625
65625
  if (normalizedTypes !== type.types) {
65626
65626
  return getIntersectionType(normalizedTypes);
@@ -71918,7 +71918,7 @@ var ts;
71918
71918
  var narrowedPropType = narrowType(propType);
71919
71919
  return filterType(type, function (t) {
71920
71920
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71921
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71921
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71922
71922
  });
71923
71923
  }
71924
71924
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -72139,11 +72139,18 @@ var ts;
72139
72139
  }
72140
72140
  var target = getReferenceCandidate(typeOfExpr.expression);
72141
72141
  if (!isMatchingReference(reference, target)) {
72142
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
72143
+ if (propertyAccess) {
72144
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
72145
+ }
72142
72146
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
72143
72147
  return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
72144
72148
  }
72145
72149
  return type;
72146
72150
  }
72151
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
72152
+ }
72153
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
72147
72154
  return assumeTrue ?
72148
72155
  narrowTypeByTypeName(type, literal.text) :
72149
72156
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
@@ -74916,6 +74923,7 @@ var ts;
74916
74923
  */
74917
74924
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
74918
74925
  var attributes = openingLikeElement.attributes;
74926
+ var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
74919
74927
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
74920
74928
  var attributesTable = ts.createSymbolTable();
74921
74929
  var spread = emptyJsxObjectType;
@@ -74943,6 +74951,12 @@ var ts;
74943
74951
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
74944
74952
  explicitlySpecifyChildrenAttribute = true;
74945
74953
  }
74954
+ if (attributesType) {
74955
+ var prop = getPropertyOfType(attributesType, member.escapedName);
74956
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
74957
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
74958
+ }
74959
+ }
74946
74960
  }
74947
74961
  else {
74948
74962
  ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
@@ -172210,13 +172224,13 @@ var ts;
172210
172224
  return __generator(this, function (_a) {
172211
172225
  switch (_a.label) {
172212
172226
  case 0:
172213
- ts.Debug.assertIsDefined(host.importServicePlugin);
172227
+ ts.Debug.assertIsDefined(host.importPlugin);
172214
172228
  resolvedPath = ts.combinePaths(initialDir, "node_modules");
172215
172229
  log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
172216
172230
  _a.label = 1;
172217
172231
  case 1:
172218
172232
  _a.trys.push([1, 3, , 4]);
172219
- return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
172233
+ return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
172220
172234
  case 2:
172221
172235
  result = _a.sent();
172222
172236
  return [3 /*break*/, 4];
@@ -173295,7 +173309,7 @@ var ts;
173295
173309
  };
173296
173310
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
173297
173311
  var host = this.projectService.host;
173298
- if (!host.require && !host.importServicePlugin) {
173312
+ if (!host.require && !host.importPlugin) {
173299
173313
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
173300
173314
  return;
173301
173315
  }
@@ -173352,7 +173366,7 @@ var ts;
173352
173366
  return __generator(this, function (_a) {
173353
173367
  switch (_a.label) {
173354
173368
  case 0:
173355
- ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
173369
+ ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
173356
173370
  log = function (message) { return _this.projectService.logger.info(message); };
173357
173371
  logError = function (message) {
173358
173372
  (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
@@ -174053,7 +174067,7 @@ var ts;
174053
174067
  /*@internal*/
174054
174068
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
174055
174069
  var host = this.projectService.host;
174056
- if (!host.require && !host.importServicePlugin) {
174070
+ if (!host.require && !host.importPlugin) {
174057
174071
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
174058
174072
  return;
174059
174073
  }
@@ -177497,7 +177511,7 @@ var ts;
177497
177511
  /*@internal*/
177498
177512
  ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
177499
177513
  var _a;
177500
- if (!this.host.importServicePlugin && !this.host.require) {
177514
+ if (!this.host.importPlugin && !this.host.require) {
177501
177515
  this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
177502
177516
  return;
177503
177517
  }
@@ -177507,7 +177521,7 @@ var ts;
177507
177521
  return;
177508
177522
  }
177509
177523
  // If the host supports dynamic import, begin enabling the plugin asynchronously.
177510
- if (this.host.importServicePlugin) {
177524
+ if (this.host.importPlugin) {
177511
177525
  var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
177512
177526
  (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
177513
177527
  var promises = this.pendingPluginEnablements.get(project);
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -44871,7 +44871,7 @@ var ts;
44871
44871
  var _a, _b;
44872
44872
  if (path === undefined)
44873
44873
  return path;
44874
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44874
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44875
44875
  }
44876
44876
  function combineDirectoryPath(root, dir) {
44877
44877
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44891,7 +44891,7 @@ var ts;
44891
44891
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44892
44892
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44893
44893
  && finalPath.indexOf("/node_modules/") === -1
44894
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44894
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44895
44895
  // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
44896
44896
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44897
44897
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44947,7 +44947,7 @@ var ts;
44947
44947
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44948
44948
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44949
44949
  var candidateDir = candidateDirectories_1[_e];
44950
- if (ts.startsWith(finalPath, candidateDir)) {
44950
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44951
44951
  // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
44952
44952
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44953
44953
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -54268,7 +54268,7 @@ var ts;
54268
54268
  }
54269
54269
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
54270
54270
  if (ts.isBindingElement(visited)) {
54271
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
54271
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
54272
54272
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
54273
54273
  /* propertyName*/ undefined, visited.propertyName,
54274
54274
  /*initializer*/ undefined);
@@ -62517,7 +62517,7 @@ var ts;
62517
62517
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62518
62518
  }
62519
62519
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62520
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62520
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62521
62521
  }
62522
62522
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62523
62523
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -63207,7 +63207,7 @@ var ts;
63207
63207
  // (T | U)[K] -> T[K] | U[K] (reading)
63208
63208
  // (T | U)[K] -> T[K] & U[K] (writing)
63209
63209
  // (T & U)[K] -> T[K] & U[K]
63210
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
63210
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
63211
63211
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
63212
63212
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
63213
63213
  }
@@ -65611,7 +65611,7 @@ var ts;
65611
65611
  if (reduced !== type) {
65612
65612
  return reduced;
65613
65613
  }
65614
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65614
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65615
65615
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65616
65616
  if (normalizedTypes !== type.types) {
65617
65617
  return getIntersectionType(normalizedTypes);
@@ -71909,7 +71909,7 @@ var ts;
71909
71909
  var narrowedPropType = narrowType(propType);
71910
71910
  return filterType(type, function (t) {
71911
71911
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71912
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71912
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71913
71913
  });
71914
71914
  }
71915
71915
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -72130,11 +72130,18 @@ var ts;
72130
72130
  }
72131
72131
  var target = getReferenceCandidate(typeOfExpr.expression);
72132
72132
  if (!isMatchingReference(reference, target)) {
72133
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
72134
+ if (propertyAccess) {
72135
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
72136
+ }
72133
72137
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
72134
72138
  return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
72135
72139
  }
72136
72140
  return type;
72137
72141
  }
72142
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
72143
+ }
72144
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
72138
72145
  return assumeTrue ?
72139
72146
  narrowTypeByTypeName(type, literal.text) :
72140
72147
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
@@ -74907,6 +74914,7 @@ var ts;
74907
74914
  */
74908
74915
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
74909
74916
  var attributes = openingLikeElement.attributes;
74917
+ var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
74910
74918
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
74911
74919
  var attributesTable = ts.createSymbolTable();
74912
74920
  var spread = emptyJsxObjectType;
@@ -74934,6 +74942,12 @@ var ts;
74934
74942
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
74935
74943
  explicitlySpecifyChildrenAttribute = true;
74936
74944
  }
74945
+ if (attributesType) {
74946
+ var prop = getPropertyOfType(attributesType, member.escapedName);
74947
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
74948
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
74949
+ }
74950
+ }
74937
74951
  }
74938
74952
  else {
74939
74953
  ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -44871,7 +44871,7 @@ var ts;
44871
44871
  var _a, _b;
44872
44872
  if (path === undefined)
44873
44873
  return path;
44874
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44874
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44875
44875
  }
44876
44876
  function combineDirectoryPath(root, dir) {
44877
44877
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44891,7 +44891,7 @@ var ts;
44891
44891
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44892
44892
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44893
44893
  && finalPath.indexOf("/node_modules/") === -1
44894
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44894
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44895
44895
  // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
44896
44896
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44897
44897
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44947,7 +44947,7 @@ var ts;
44947
44947
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44948
44948
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44949
44949
  var candidateDir = candidateDirectories_1[_e];
44950
- if (ts.startsWith(finalPath, candidateDir)) {
44950
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44951
44951
  // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
44952
44952
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44953
44953
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -54268,7 +54268,7 @@ var ts;
54268
54268
  }
54269
54269
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
54270
54270
  if (ts.isBindingElement(visited)) {
54271
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
54271
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
54272
54272
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
54273
54273
  /* propertyName*/ undefined, visited.propertyName,
54274
54274
  /*initializer*/ undefined);
@@ -62517,7 +62517,7 @@ var ts;
62517
62517
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62518
62518
  }
62519
62519
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62520
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62520
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62521
62521
  }
62522
62522
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62523
62523
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -63207,7 +63207,7 @@ var ts;
63207
63207
  // (T | U)[K] -> T[K] | U[K] (reading)
63208
63208
  // (T | U)[K] -> T[K] & U[K] (writing)
63209
63209
  // (T & U)[K] -> T[K] & U[K]
63210
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
63210
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
63211
63211
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
63212
63212
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
63213
63213
  }
@@ -65611,7 +65611,7 @@ var ts;
65611
65611
  if (reduced !== type) {
65612
65612
  return reduced;
65613
65613
  }
65614
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65614
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65615
65615
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65616
65616
  if (normalizedTypes !== type.types) {
65617
65617
  return getIntersectionType(normalizedTypes);
@@ -71909,7 +71909,7 @@ var ts;
71909
71909
  var narrowedPropType = narrowType(propType);
71910
71910
  return filterType(type, function (t) {
71911
71911
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71912
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71912
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71913
71913
  });
71914
71914
  }
71915
71915
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -72130,11 +72130,18 @@ var ts;
72130
72130
  }
72131
72131
  var target = getReferenceCandidate(typeOfExpr.expression);
72132
72132
  if (!isMatchingReference(reference, target)) {
72133
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
72134
+ if (propertyAccess) {
72135
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
72136
+ }
72133
72137
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
72134
72138
  return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
72135
72139
  }
72136
72140
  return type;
72137
72141
  }
72142
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
72143
+ }
72144
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
72138
72145
  return assumeTrue ?
72139
72146
  narrowTypeByTypeName(type, literal.text) :
72140
72147
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
@@ -74907,6 +74914,7 @@ var ts;
74907
74914
  */
74908
74915
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
74909
74916
  var attributes = openingLikeElement.attributes;
74917
+ var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
74910
74918
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
74911
74919
  var attributesTable = ts.createSymbolTable();
74912
74920
  var spread = emptyJsxObjectType;
@@ -74934,6 +74942,12 @@ var ts;
74934
74942
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
74935
74943
  explicitlySpecifyChildrenAttribute = true;
74936
74944
  }
74945
+ if (attributesType) {
74946
+ var prop = getPropertyOfType(attributesType, member.escapedName);
74947
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
74948
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
74949
+ }
74950
+ }
74937
74951
  }
74938
74952
  else {
74939
74953
  ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220830");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220902");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -44861,7 +44861,7 @@ var ts;
44861
44861
  var _a, _b;
44862
44862
  if (path === undefined)
44863
44863
  return path;
44864
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44864
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44865
44865
  }
44866
44866
  function combineDirectoryPath(root, dir) {
44867
44867
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44881,7 +44881,7 @@ var ts;
44881
44881
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44882
44882
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44883
44883
  && finalPath.indexOf("/node_modules/") === -1
44884
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44884
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44885
44885
  // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
44886
44886
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44887
44887
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44937,7 +44937,7 @@ var ts;
44937
44937
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44938
44938
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44939
44939
  var candidateDir = candidateDirectories_1[_e];
44940
- if (ts.startsWith(finalPath, candidateDir)) {
44940
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44941
44941
  // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
44942
44942
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44943
44943
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -54258,7 +54258,7 @@ var ts;
54258
54258
  }
54259
54259
  var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
54260
54260
  if (ts.isBindingElement(visited)) {
54261
- if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
54261
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name) && !ts.isStringAKeyword(ts.idText(visited.propertyName))) {
54262
54262
  visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
54263
54263
  /* propertyName*/ undefined, visited.propertyName,
54264
54264
  /*initializer*/ undefined);
@@ -62507,7 +62507,7 @@ var ts;
62507
62507
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62508
62508
  }
62509
62509
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62510
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62510
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62511
62511
  }
62512
62512
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62513
62513
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -63197,7 +63197,7 @@ var ts;
63197
63197
  // (T | U)[K] -> T[K] | U[K] (reading)
63198
63198
  // (T | U)[K] -> T[K] & U[K] (writing)
63199
63199
  // (T & U)[K] -> T[K] & U[K]
63200
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
63200
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
63201
63201
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
63202
63202
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
63203
63203
  }
@@ -65601,7 +65601,7 @@ var ts;
65601
65601
  if (reduced !== type) {
65602
65602
  return reduced;
65603
65603
  }
65604
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65604
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65605
65605
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65606
65606
  if (normalizedTypes !== type.types) {
65607
65607
  return getIntersectionType(normalizedTypes);
@@ -71899,7 +71899,7 @@ var ts;
71899
71899
  var narrowedPropType = narrowType(propType);
71900
71900
  return filterType(type, function (t) {
71901
71901
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71902
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71902
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71903
71903
  });
71904
71904
  }
71905
71905
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -72120,11 +72120,18 @@ var ts;
72120
72120
  }
72121
72121
  var target = getReferenceCandidate(typeOfExpr.expression);
72122
72122
  if (!isMatchingReference(reference, target)) {
72123
+ var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
72124
+ if (propertyAccess) {
72125
+ return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
72126
+ }
72123
72127
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
72124
72128
  return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
72125
72129
  }
72126
72130
  return type;
72127
72131
  }
72132
+ return narrowTypeByLiteralExpression(type, literal, assumeTrue);
72133
+ }
72134
+ function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
72128
72135
  return assumeTrue ?
72129
72136
  narrowTypeByTypeName(type, literal.text) :
72130
72137
  getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
@@ -74897,6 +74904,7 @@ var ts;
74897
74904
  */
74898
74905
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
74899
74906
  var attributes = openingLikeElement.attributes;
74907
+ var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
74900
74908
  var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
74901
74909
  var attributesTable = ts.createSymbolTable();
74902
74910
  var spread = emptyJsxObjectType;
@@ -74924,6 +74932,12 @@ var ts;
74924
74932
  if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
74925
74933
  explicitlySpecifyChildrenAttribute = true;
74926
74934
  }
74935
+ if (attributesType) {
74936
+ var prop = getPropertyOfType(attributesType, member.escapedName);
74937
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
74938
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
74939
+ }
74940
+ }
74927
74941
  }
74928
74942
  else {
74929
74943
  ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.9.0-dev.20220830",
5
+ "version": "4.9.0-dev.20220902",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [