typescript 4.9.0-dev.20220831 → 4.9.0-dev.20220901

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
@@ -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.20220831");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -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);
@@ -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);
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.20220831");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -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);
@@ -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 */);
@@ -172211,13 +172218,13 @@ var ts;
172211
172218
  return __generator(this, function (_a) {
172212
172219
  switch (_a.label) {
172213
172220
  case 0:
172214
- ts.Debug.assertIsDefined(host.importServicePlugin);
172221
+ ts.Debug.assertIsDefined(host.importPlugin);
172215
172222
  resolvedPath = ts.combinePaths(initialDir, "node_modules");
172216
172223
  log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
172217
172224
  _a.label = 1;
172218
172225
  case 1:
172219
172226
  _a.trys.push([1, 3, , 4]);
172220
- return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
172227
+ return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
172221
172228
  case 2:
172222
172229
  result = _a.sent();
172223
172230
  return [3 /*break*/, 4];
@@ -173296,7 +173303,7 @@ var ts;
173296
173303
  };
173297
173304
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
173298
173305
  var host = this.projectService.host;
173299
- if (!host.require && !host.importServicePlugin) {
173306
+ if (!host.require && !host.importPlugin) {
173300
173307
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
173301
173308
  return;
173302
173309
  }
@@ -173353,7 +173360,7 @@ var ts;
173353
173360
  return __generator(this, function (_a) {
173354
173361
  switch (_a.label) {
173355
173362
  case 0:
173356
- ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
173363
+ ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
173357
173364
  log = function (message) { return _this.projectService.logger.info(message); };
173358
173365
  logError = function (message) {
173359
173366
  (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
@@ -174054,7 +174061,7 @@ var ts;
174054
174061
  /*@internal*/
174055
174062
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
174056
174063
  var host = this.projectService.host;
174057
- if (!host.require && !host.importServicePlugin) {
174064
+ if (!host.require && !host.importPlugin) {
174058
174065
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
174059
174066
  return;
174060
174067
  }
@@ -177498,7 +177505,7 @@ var ts;
177498
177505
  /*@internal*/
177499
177506
  ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
177500
177507
  var _a;
177501
- if (!this.host.importServicePlugin && !this.host.require) {
177508
+ if (!this.host.importPlugin && !this.host.require) {
177502
177509
  this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
177503
177510
  return;
177504
177511
  }
@@ -177508,7 +177515,7 @@ var ts;
177508
177515
  return;
177509
177516
  }
177510
177517
  // If the host supports dynamic import, begin enabling the plugin asynchronously.
177511
- if (this.host.importServicePlugin) {
177518
+ if (this.host.importPlugin) {
177512
177519
  var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
177513
177520
  (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
177514
177521
  var promises = this.pendingPluginEnablements.get(project);
@@ -181807,7 +181814,7 @@ var ts;
181807
181814
  setImmediate: function (x) { return setTimeout(x, 0); },
181808
181815
  clearImmediate: function (handle) { return clearTimeout(handle); },
181809
181816
  /* eslint-enable no-restricted-globals */
181810
- importServicePlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181817
+ importPlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181811
181818
  var packageRoot, packageJson, packageJsonResponse, e_1, browser, scriptPath, module_1, e_2;
181812
181819
  return __generator(this, function (_a) {
181813
181820
  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.20220831");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -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);
@@ -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 */);
@@ -172210,13 +172217,13 @@ var ts;
172210
172217
  return __generator(this, function (_a) {
172211
172218
  switch (_a.label) {
172212
172219
  case 0:
172213
- ts.Debug.assertIsDefined(host.importServicePlugin);
172220
+ ts.Debug.assertIsDefined(host.importPlugin);
172214
172221
  resolvedPath = ts.combinePaths(initialDir, "node_modules");
172215
172222
  log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
172216
172223
  _a.label = 1;
172217
172224
  case 1:
172218
172225
  _a.trys.push([1, 3, , 4]);
172219
- return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
172226
+ return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
172220
172227
  case 2:
172221
172228
  result = _a.sent();
172222
172229
  return [3 /*break*/, 4];
@@ -173295,7 +173302,7 @@ var ts;
173295
173302
  };
173296
173303
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
173297
173304
  var host = this.projectService.host;
173298
- if (!host.require && !host.importServicePlugin) {
173305
+ if (!host.require && !host.importPlugin) {
173299
173306
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
173300
173307
  return;
173301
173308
  }
@@ -173352,7 +173359,7 @@ var ts;
173352
173359
  return __generator(this, function (_a) {
173353
173360
  switch (_a.label) {
173354
173361
  case 0:
173355
- ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
173362
+ ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
173356
173363
  log = function (message) { return _this.projectService.logger.info(message); };
173357
173364
  logError = function (message) {
173358
173365
  (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
@@ -174053,7 +174060,7 @@ var ts;
174053
174060
  /*@internal*/
174054
174061
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
174055
174062
  var host = this.projectService.host;
174056
- if (!host.require && !host.importServicePlugin) {
174063
+ if (!host.require && !host.importPlugin) {
174057
174064
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
174058
174065
  return;
174059
174066
  }
@@ -177497,7 +177504,7 @@ var ts;
177497
177504
  /*@internal*/
177498
177505
  ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
177499
177506
  var _a;
177500
- if (!this.host.importServicePlugin && !this.host.require) {
177507
+ if (!this.host.importPlugin && !this.host.require) {
177501
177508
  this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
177502
177509
  return;
177503
177510
  }
@@ -177507,7 +177514,7 @@ var ts;
177507
177514
  return;
177508
177515
  }
177509
177516
  // If the host supports dynamic import, begin enabling the plugin asynchronously.
177510
- if (this.host.importServicePlugin) {
177517
+ if (this.host.importPlugin) {
177511
177518
  var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
177512
177519
  (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
177513
177520
  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.20220831");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -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);
@@ -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 */);
@@ -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.20220831");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -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);
@@ -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 */);
@@ -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.20220831");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220901");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -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);
@@ -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 */);
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.20220831",
5
+ "version": "4.9.0-dev.20220901",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [