@typescript-deploys/pr-build 4.6.0-pr-45974-9 → 4.7.0-pr-45974-15

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/tsserver.js CHANGED
@@ -96,11 +96,11 @@ var ts;
96
96
  (function (ts) {
97
97
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
98
98
  // If changing the text in this section, be sure to test `configurePrerelease` too.
99
- ts.versionMajorMinor = "4.6";
99
+ ts.versionMajorMinor = "4.7";
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220214";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -42472,7 +42472,13 @@ var ts;
42472
42472
  onlyRecordFailures = true;
42473
42473
  }
42474
42474
  }
42475
- return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42475
+ // esm mode relative imports shouldn't do any directory lookups (either inside `package.json`
42476
+ // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg`
42477
+ // could have been redirected by `./foo/pkg/package.json` to an arbitrary location!
42478
+ if (!(state.features & NodeResolutionFeatures.EsmMode)) {
42479
+ return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42480
+ }
42481
+ return undefined;
42476
42482
  }
42477
42483
  /*@internal*/
42478
42484
  ts.nodeModulesPathPart = "/node_modules/";
@@ -43184,6 +43190,14 @@ var ts;
43184
43190
  }
43185
43191
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
43186
43192
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
43193
+ if (!pathAndExtension && packageInfo
43194
+ && packageInfo.packageJsonContent.exports === undefined
43195
+ && packageInfo.packageJsonContent.main === undefined
43196
+ && state.features & NodeResolutionFeatures.EsmMode) {
43197
+ // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
43198
+ // a default `index.js` entrypoint if no `main` or `exports` are present
43199
+ pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
43200
+ }
43187
43201
  return withPackageId(packageInfo, pathAndExtension);
43188
43202
  };
43189
43203
  if (rest !== "") { // If "rest" is empty, we just did this search above.
@@ -44178,7 +44192,7 @@ var ts;
44178
44192
  return ts.isDottedName(expr)
44179
44193
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44180
44194
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44181
- || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44195
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44182
44196
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44183
44197
  }
44184
44198
  function containsNarrowableReference(expr) {
@@ -50401,8 +50415,15 @@ var ts;
50401
50415
  return res;
50402
50416
  }
50403
50417
  var candidates = ts.mapDefined(symbol.declarations, function (d) {
50404
- if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50405
- return getSymbolOfNode(d.parent);
50418
+ if (!ts.isAmbientModule(d) && d.parent) {
50419
+ // direct children of a module
50420
+ if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50421
+ return getSymbolOfNode(d.parent);
50422
+ }
50423
+ // export ='d member of an ambient module
50424
+ if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
50425
+ return getSymbolOfNode(d.parent.parent);
50426
+ }
50406
50427
  }
50407
50428
  if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
50408
50429
  if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
@@ -63137,9 +63158,11 @@ var ts;
63137
63158
  isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
63138
63159
  return true;
63139
63160
  }
63140
- if (s & 32768 /* Undefined */ && (!strictNullChecks || t & (32768 /* Undefined */ | 16384 /* Void */)))
63161
+ // In non-strictNullChecks mode, `undefined` and `null` are assignable to anything except `never`.
63162
+ // Since unions and intersections may reduce to `never`, we exclude them here.
63163
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
63141
63164
  return true;
63142
- if (s & 65536 /* Null */ && (!strictNullChecks || t & 65536 /* Null */))
63165
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
63143
63166
  return true;
63144
63167
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
63145
63168
  return true;
@@ -64595,6 +64618,11 @@ var ts;
64595
64618
  }
64596
64619
  if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
64597
64620
  !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 /* MarkerType */ || ts.getObjectFlags(target) & 4096 /* MarkerType */)) {
64621
+ // When strictNullChecks is disabled, the element type of the empty array literal is undefinedWideningType,
64622
+ // and an empty array literal wouldn't be assignable to a `never[]` without this check.
64623
+ if (isEmptyArrayLiteralType(source)) {
64624
+ return -1 /* True */;
64625
+ }
64598
64626
  // We have type references to the same generic type, and the type references are not marker
64599
64627
  // type references (which are intended by be compared structurally). Obtain the variance
64600
64628
  // information for the type parameters and relate the type arguments accordingly.
@@ -64901,6 +64929,15 @@ var ts;
64901
64929
  }
64902
64930
  return 0 /* False */;
64903
64931
  }
64932
+ // Ensure {readonly a: whatever} is not a subtype of {a: whatever},
64933
+ // while {a: whatever} is a subtype of {readonly a: whatever}.
64934
+ // This ensures the subtype relationship is ordered, and preventing declaration order
64935
+ // from deciding which type "wins" in union subtype reduction.
64936
+ // They're still assignable to one another, since `readonly` doesn't affect assignability.
64937
+ if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
64938
+ !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
64939
+ return 0 /* False */;
64940
+ }
64904
64941
  // If the target comes from a partial union prop, allow `undefined` in the target type
64905
64942
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
64906
64943
  if (!related) {
@@ -67842,9 +67879,9 @@ var ts;
67842
67879
  if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
67843
67880
  return ts.escapeLeadingUnderscores(node.argumentExpression.text);
67844
67881
  }
67845
- if (ts.isIdentifier(node.argumentExpression)) {
67846
- var symbol = getResolvedSymbol(node.argumentExpression);
67847
- if (!isConstVariable(symbol))
67882
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
67883
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
67884
+ if (!symbol || !isConstVariable(symbol))
67848
67885
  return undefined;
67849
67886
  var declaration = symbol.valueDeclaration;
67850
67887
  if (declaration === undefined)
@@ -14,7 +14,7 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
  declare namespace ts {
17
- const versionMajorMinor = "4.6";
17
+ const versionMajorMinor = "4.7";
18
18
  /** The version of the TypeScript compiler release */
19
19
  const version: string;
20
20
  /**
@@ -290,11 +290,11 @@ var ts;
290
290
  (function (ts) {
291
291
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
292
292
  // If changing the text in this section, be sure to test `configurePrerelease` too.
293
- ts.versionMajorMinor = "4.6";
293
+ ts.versionMajorMinor = "4.7";
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220214";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -42666,7 +42666,13 @@ var ts;
42666
42666
  onlyRecordFailures = true;
42667
42667
  }
42668
42668
  }
42669
- return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42669
+ // esm mode relative imports shouldn't do any directory lookups (either inside `package.json`
42670
+ // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg`
42671
+ // could have been redirected by `./foo/pkg/package.json` to an arbitrary location!
42672
+ if (!(state.features & NodeResolutionFeatures.EsmMode)) {
42673
+ return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42674
+ }
42675
+ return undefined;
42670
42676
  }
42671
42677
  /*@internal*/
42672
42678
  ts.nodeModulesPathPart = "/node_modules/";
@@ -43378,6 +43384,14 @@ var ts;
43378
43384
  }
43379
43385
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
43380
43386
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
43387
+ if (!pathAndExtension && packageInfo
43388
+ && packageInfo.packageJsonContent.exports === undefined
43389
+ && packageInfo.packageJsonContent.main === undefined
43390
+ && state.features & NodeResolutionFeatures.EsmMode) {
43391
+ // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
43392
+ // a default `index.js` entrypoint if no `main` or `exports` are present
43393
+ pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
43394
+ }
43381
43395
  return withPackageId(packageInfo, pathAndExtension);
43382
43396
  };
43383
43397
  if (rest !== "") { // If "rest" is empty, we just did this search above.
@@ -44372,7 +44386,7 @@ var ts;
44372
44386
  return ts.isDottedName(expr)
44373
44387
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44374
44388
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44375
- || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44389
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44376
44390
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44377
44391
  }
44378
44392
  function containsNarrowableReference(expr) {
@@ -50595,8 +50609,15 @@ var ts;
50595
50609
  return res;
50596
50610
  }
50597
50611
  var candidates = ts.mapDefined(symbol.declarations, function (d) {
50598
- if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50599
- return getSymbolOfNode(d.parent);
50612
+ if (!ts.isAmbientModule(d) && d.parent) {
50613
+ // direct children of a module
50614
+ if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50615
+ return getSymbolOfNode(d.parent);
50616
+ }
50617
+ // export ='d member of an ambient module
50618
+ if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
50619
+ return getSymbolOfNode(d.parent.parent);
50620
+ }
50600
50621
  }
50601
50622
  if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
50602
50623
  if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
@@ -63331,9 +63352,11 @@ var ts;
63331
63352
  isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
63332
63353
  return true;
63333
63354
  }
63334
- if (s & 32768 /* Undefined */ && (!strictNullChecks || t & (32768 /* Undefined */ | 16384 /* Void */)))
63355
+ // In non-strictNullChecks mode, `undefined` and `null` are assignable to anything except `never`.
63356
+ // Since unions and intersections may reduce to `never`, we exclude them here.
63357
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
63335
63358
  return true;
63336
- if (s & 65536 /* Null */ && (!strictNullChecks || t & 65536 /* Null */))
63359
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
63337
63360
  return true;
63338
63361
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
63339
63362
  return true;
@@ -64789,6 +64812,11 @@ var ts;
64789
64812
  }
64790
64813
  if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
64791
64814
  !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 /* MarkerType */ || ts.getObjectFlags(target) & 4096 /* MarkerType */)) {
64815
+ // When strictNullChecks is disabled, the element type of the empty array literal is undefinedWideningType,
64816
+ // and an empty array literal wouldn't be assignable to a `never[]` without this check.
64817
+ if (isEmptyArrayLiteralType(source)) {
64818
+ return -1 /* True */;
64819
+ }
64792
64820
  // We have type references to the same generic type, and the type references are not marker
64793
64821
  // type references (which are intended by be compared structurally). Obtain the variance
64794
64822
  // information for the type parameters and relate the type arguments accordingly.
@@ -65095,6 +65123,15 @@ var ts;
65095
65123
  }
65096
65124
  return 0 /* False */;
65097
65125
  }
65126
+ // Ensure {readonly a: whatever} is not a subtype of {a: whatever},
65127
+ // while {a: whatever} is a subtype of {readonly a: whatever}.
65128
+ // This ensures the subtype relationship is ordered, and preventing declaration order
65129
+ // from deciding which type "wins" in union subtype reduction.
65130
+ // They're still assignable to one another, since `readonly` doesn't affect assignability.
65131
+ if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65132
+ !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65133
+ return 0 /* False */;
65134
+ }
65098
65135
  // If the target comes from a partial union prop, allow `undefined` in the target type
65099
65136
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
65100
65137
  if (!related) {
@@ -68036,9 +68073,9 @@ var ts;
68036
68073
  if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68037
68074
  return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68038
68075
  }
68039
- if (ts.isIdentifier(node.argumentExpression)) {
68040
- var symbol = getResolvedSymbol(node.argumentExpression);
68041
- if (!isConstVariable(symbol))
68076
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
68077
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
68078
+ if (!symbol || !isConstVariable(symbol))
68042
68079
  return undefined;
68043
68080
  var declaration = symbol.valueDeclaration;
68044
68081
  if (declaration === undefined)
@@ -14,7 +14,7 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
  declare namespace ts {
17
- const versionMajorMinor = "4.6";
17
+ const versionMajorMinor = "4.7";
18
18
  /** The version of the TypeScript compiler release */
19
19
  const version: string;
20
20
  /**
package/lib/typescript.js CHANGED
@@ -290,11 +290,11 @@ var ts;
290
290
  (function (ts) {
291
291
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
292
292
  // If changing the text in this section, be sure to test `configurePrerelease` too.
293
- ts.versionMajorMinor = "4.6";
293
+ ts.versionMajorMinor = "4.7";
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220214";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -42666,7 +42666,13 @@ var ts;
42666
42666
  onlyRecordFailures = true;
42667
42667
  }
42668
42668
  }
42669
- return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42669
+ // esm mode relative imports shouldn't do any directory lookups (either inside `package.json`
42670
+ // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg`
42671
+ // could have been redirected by `./foo/pkg/package.json` to an arbitrary location!
42672
+ if (!(state.features & NodeResolutionFeatures.EsmMode)) {
42673
+ return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42674
+ }
42675
+ return undefined;
42670
42676
  }
42671
42677
  /*@internal*/
42672
42678
  ts.nodeModulesPathPart = "/node_modules/";
@@ -43378,6 +43384,14 @@ var ts;
43378
43384
  }
43379
43385
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
43380
43386
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
43387
+ if (!pathAndExtension && packageInfo
43388
+ && packageInfo.packageJsonContent.exports === undefined
43389
+ && packageInfo.packageJsonContent.main === undefined
43390
+ && state.features & NodeResolutionFeatures.EsmMode) {
43391
+ // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
43392
+ // a default `index.js` entrypoint if no `main` or `exports` are present
43393
+ pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
43394
+ }
43381
43395
  return withPackageId(packageInfo, pathAndExtension);
43382
43396
  };
43383
43397
  if (rest !== "") { // If "rest" is empty, we just did this search above.
@@ -44372,7 +44386,7 @@ var ts;
44372
44386
  return ts.isDottedName(expr)
44373
44387
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44374
44388
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44375
- || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44389
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44376
44390
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44377
44391
  }
44378
44392
  function containsNarrowableReference(expr) {
@@ -50595,8 +50609,15 @@ var ts;
50595
50609
  return res;
50596
50610
  }
50597
50611
  var candidates = ts.mapDefined(symbol.declarations, function (d) {
50598
- if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50599
- return getSymbolOfNode(d.parent);
50612
+ if (!ts.isAmbientModule(d) && d.parent) {
50613
+ // direct children of a module
50614
+ if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50615
+ return getSymbolOfNode(d.parent);
50616
+ }
50617
+ // export ='d member of an ambient module
50618
+ if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
50619
+ return getSymbolOfNode(d.parent.parent);
50620
+ }
50600
50621
  }
50601
50622
  if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
50602
50623
  if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
@@ -63331,9 +63352,11 @@ var ts;
63331
63352
  isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
63332
63353
  return true;
63333
63354
  }
63334
- if (s & 32768 /* Undefined */ && (!strictNullChecks || t & (32768 /* Undefined */ | 16384 /* Void */)))
63355
+ // In non-strictNullChecks mode, `undefined` and `null` are assignable to anything except `never`.
63356
+ // Since unions and intersections may reduce to `never`, we exclude them here.
63357
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
63335
63358
  return true;
63336
- if (s & 65536 /* Null */ && (!strictNullChecks || t & 65536 /* Null */))
63359
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
63337
63360
  return true;
63338
63361
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
63339
63362
  return true;
@@ -64789,6 +64812,11 @@ var ts;
64789
64812
  }
64790
64813
  if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
64791
64814
  !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 /* MarkerType */ || ts.getObjectFlags(target) & 4096 /* MarkerType */)) {
64815
+ // When strictNullChecks is disabled, the element type of the empty array literal is undefinedWideningType,
64816
+ // and an empty array literal wouldn't be assignable to a `never[]` without this check.
64817
+ if (isEmptyArrayLiteralType(source)) {
64818
+ return -1 /* True */;
64819
+ }
64792
64820
  // We have type references to the same generic type, and the type references are not marker
64793
64821
  // type references (which are intended by be compared structurally). Obtain the variance
64794
64822
  // information for the type parameters and relate the type arguments accordingly.
@@ -65095,6 +65123,15 @@ var ts;
65095
65123
  }
65096
65124
  return 0 /* False */;
65097
65125
  }
65126
+ // Ensure {readonly a: whatever} is not a subtype of {a: whatever},
65127
+ // while {a: whatever} is a subtype of {readonly a: whatever}.
65128
+ // This ensures the subtype relationship is ordered, and preventing declaration order
65129
+ // from deciding which type "wins" in union subtype reduction.
65130
+ // They're still assignable to one another, since `readonly` doesn't affect assignability.
65131
+ if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65132
+ !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65133
+ return 0 /* False */;
65134
+ }
65098
65135
  // If the target comes from a partial union prop, allow `undefined` in the target type
65099
65136
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
65100
65137
  if (!related) {
@@ -68036,9 +68073,9 @@ var ts;
68036
68073
  if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68037
68074
  return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68038
68075
  }
68039
- if (ts.isIdentifier(node.argumentExpression)) {
68040
- var symbol = getResolvedSymbol(node.argumentExpression);
68041
- if (!isConstVariable(symbol))
68076
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
68077
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
68078
+ if (!symbol || !isConstVariable(symbol))
68042
68079
  return undefined;
68043
68080
  var declaration = symbol.valueDeclaration;
68044
68081
  if (declaration === undefined)
@@ -14,7 +14,7 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
 
16
16
  declare namespace ts {
17
- const versionMajorMinor = "4.6";
17
+ const versionMajorMinor = "4.7";
18
18
  /** The version of the TypeScript compiler release */
19
19
  const version: string;
20
20
  /**
@@ -290,11 +290,11 @@ var ts;
290
290
  (function (ts) {
291
291
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
292
292
  // If changing the text in this section, be sure to test `configurePrerelease` too.
293
- ts.versionMajorMinor = "4.6";
293
+ ts.versionMajorMinor = "4.7";
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220214";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -42666,7 +42666,13 @@ var ts;
42666
42666
  onlyRecordFailures = true;
42667
42667
  }
42668
42668
  }
42669
- return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42669
+ // esm mode relative imports shouldn't do any directory lookups (either inside `package.json`
42670
+ // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg`
42671
+ // could have been redirected by `./foo/pkg/package.json` to an arbitrary location!
42672
+ if (!(state.features & NodeResolutionFeatures.EsmMode)) {
42673
+ return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42674
+ }
42675
+ return undefined;
42670
42676
  }
42671
42677
  /*@internal*/
42672
42678
  ts.nodeModulesPathPart = "/node_modules/";
@@ -43378,6 +43384,14 @@ var ts;
43378
43384
  }
43379
43385
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
43380
43386
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
43387
+ if (!pathAndExtension && packageInfo
43388
+ && packageInfo.packageJsonContent.exports === undefined
43389
+ && packageInfo.packageJsonContent.main === undefined
43390
+ && state.features & NodeResolutionFeatures.EsmMode) {
43391
+ // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
43392
+ // a default `index.js` entrypoint if no `main` or `exports` are present
43393
+ pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
43394
+ }
43381
43395
  return withPackageId(packageInfo, pathAndExtension);
43382
43396
  };
43383
43397
  if (rest !== "") { // If "rest" is empty, we just did this search above.
@@ -44372,7 +44386,7 @@ var ts;
44372
44386
  return ts.isDottedName(expr)
44373
44387
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44374
44388
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44375
- || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44389
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44376
44390
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44377
44391
  }
44378
44392
  function containsNarrowableReference(expr) {
@@ -50595,8 +50609,15 @@ var ts;
50595
50609
  return res;
50596
50610
  }
50597
50611
  var candidates = ts.mapDefined(symbol.declarations, function (d) {
50598
- if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50599
- return getSymbolOfNode(d.parent);
50612
+ if (!ts.isAmbientModule(d) && d.parent) {
50613
+ // direct children of a module
50614
+ if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50615
+ return getSymbolOfNode(d.parent);
50616
+ }
50617
+ // export ='d member of an ambient module
50618
+ if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
50619
+ return getSymbolOfNode(d.parent.parent);
50620
+ }
50600
50621
  }
50601
50622
  if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
50602
50623
  if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
@@ -63331,9 +63352,11 @@ var ts;
63331
63352
  isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
63332
63353
  return true;
63333
63354
  }
63334
- if (s & 32768 /* Undefined */ && (!strictNullChecks || t & (32768 /* Undefined */ | 16384 /* Void */)))
63355
+ // In non-strictNullChecks mode, `undefined` and `null` are assignable to anything except `never`.
63356
+ // Since unions and intersections may reduce to `never`, we exclude them here.
63357
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
63335
63358
  return true;
63336
- if (s & 65536 /* Null */ && (!strictNullChecks || t & 65536 /* Null */))
63359
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
63337
63360
  return true;
63338
63361
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
63339
63362
  return true;
@@ -64789,6 +64812,11 @@ var ts;
64789
64812
  }
64790
64813
  if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
64791
64814
  !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 /* MarkerType */ || ts.getObjectFlags(target) & 4096 /* MarkerType */)) {
64815
+ // When strictNullChecks is disabled, the element type of the empty array literal is undefinedWideningType,
64816
+ // and an empty array literal wouldn't be assignable to a `never[]` without this check.
64817
+ if (isEmptyArrayLiteralType(source)) {
64818
+ return -1 /* True */;
64819
+ }
64792
64820
  // We have type references to the same generic type, and the type references are not marker
64793
64821
  // type references (which are intended by be compared structurally). Obtain the variance
64794
64822
  // information for the type parameters and relate the type arguments accordingly.
@@ -65095,6 +65123,15 @@ var ts;
65095
65123
  }
65096
65124
  return 0 /* False */;
65097
65125
  }
65126
+ // Ensure {readonly a: whatever} is not a subtype of {a: whatever},
65127
+ // while {a: whatever} is a subtype of {readonly a: whatever}.
65128
+ // This ensures the subtype relationship is ordered, and preventing declaration order
65129
+ // from deciding which type "wins" in union subtype reduction.
65130
+ // They're still assignable to one another, since `readonly` doesn't affect assignability.
65131
+ if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65132
+ !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65133
+ return 0 /* False */;
65134
+ }
65098
65135
  // If the target comes from a partial union prop, allow `undefined` in the target type
65099
65136
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
65100
65137
  if (!related) {
@@ -68036,9 +68073,9 @@ var ts;
68036
68073
  if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68037
68074
  return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68038
68075
  }
68039
- if (ts.isIdentifier(node.argumentExpression)) {
68040
- var symbol = getResolvedSymbol(node.argumentExpression);
68041
- if (!isConstVariable(symbol))
68076
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
68077
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
68078
+ if (!symbol || !isConstVariable(symbol))
68042
68079
  return undefined;
68043
68080
  var declaration = symbol.valueDeclaration;
68044
68081
  if (declaration === undefined)