typescript 4.7.0-dev.20220416 → 4.7.0-dev.20220419

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.7";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220416";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -26733,7 +26733,7 @@ var ts;
26733
26733
  var pos = getNodePos();
26734
26734
  parseExpected(112);
26735
26735
  var entityName = parseEntityName(true, true);
26736
- var typeArguments = tryParseTypeArguments();
26736
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
26737
26737
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
26738
26738
  }
26739
26739
  function parseTypeParameter() {
@@ -51418,8 +51418,11 @@ var ts;
51418
51418
  return type[cache] = elementType;
51419
51419
  }
51420
51420
  }
51421
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
51422
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
51421
+ if (isGenericMappedType(objectType)) {
51422
+ var nameType = getNameTypeFromMappedType(objectType);
51423
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
51424
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
51425
+ }
51423
51426
  }
51424
51427
  return type[cache] = type;
51425
51428
  }
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
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-dev.20220416";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -33186,7 +33186,8 @@ var ts;
33186
33186
  var pos = getNodePos();
33187
33187
  parseExpected(112 /* TypeOfKeyword */);
33188
33188
  var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33189
- var typeArguments = tryParseTypeArguments();
33189
+ // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33190
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33190
33191
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
33191
33192
  }
33192
33193
  function parseTypeParameter() {
@@ -61934,11 +61935,14 @@ var ts;
61934
61935
  return type[cache] = elementType;
61935
61936
  }
61936
61937
  }
61937
- // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
61938
- // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
61939
- // construct the type Box<T[X]>.
61940
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
61941
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61938
+ // If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
61939
+ // K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
61940
+ // For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
61941
+ if (isGenericMappedType(objectType)) {
61942
+ var nameType = getNameTypeFromMappedType(objectType);
61943
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
61944
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61945
+ }
61942
61946
  }
61943
61947
  return type[cache] = type;
61944
61948
  }
@@ -294,7 +294,7 @@ var ts;
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-dev.20220416";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -33380,7 +33380,8 @@ var ts;
33380
33380
  var pos = getNodePos();
33381
33381
  parseExpected(112 /* TypeOfKeyword */);
33382
33382
  var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33383
- var typeArguments = tryParseTypeArguments();
33383
+ // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33384
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33384
33385
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
33385
33386
  }
33386
33387
  function parseTypeParameter() {
@@ -62128,11 +62129,14 @@ var ts;
62128
62129
  return type[cache] = elementType;
62129
62130
  }
62130
62131
  }
62131
- // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
62132
- // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
62133
- // construct the type Box<T[X]>.
62134
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
62135
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62132
+ // If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
62133
+ // K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
62134
+ // For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
62135
+ if (isGenericMappedType(objectType)) {
62136
+ var nameType = getNameTypeFromMappedType(objectType);
62137
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
62138
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62139
+ }
62136
62140
  }
62137
62141
  return type[cache] = type;
62138
62142
  }
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
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-dev.20220416";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -33380,7 +33380,8 @@ var ts;
33380
33380
  var pos = getNodePos();
33381
33381
  parseExpected(112 /* TypeOfKeyword */);
33382
33382
  var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33383
- var typeArguments = tryParseTypeArguments();
33383
+ // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33384
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33384
33385
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
33385
33386
  }
33386
33387
  function parseTypeParameter() {
@@ -62128,11 +62129,14 @@ var ts;
62128
62129
  return type[cache] = elementType;
62129
62130
  }
62130
62131
  }
62131
- // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
62132
- // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
62133
- // construct the type Box<T[X]>.
62134
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
62135
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62132
+ // If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
62133
+ // K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
62134
+ // For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
62135
+ if (isGenericMappedType(objectType)) {
62136
+ var nameType = getNameTypeFromMappedType(objectType);
62137
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
62138
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62139
+ }
62136
62140
  }
62137
62141
  return type[cache] = type;
62138
62142
  }
@@ -294,7 +294,7 @@ var ts;
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-dev.20220416";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -33380,7 +33380,8 @@ var ts;
33380
33380
  var pos = getNodePos();
33381
33381
  parseExpected(112 /* TypeOfKeyword */);
33382
33382
  var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33383
- var typeArguments = tryParseTypeArguments();
33383
+ // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33384
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33384
33385
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
33385
33386
  }
33386
33387
  function parseTypeParameter() {
@@ -62128,11 +62129,14 @@ var ts;
62128
62129
  return type[cache] = elementType;
62129
62130
  }
62130
62131
  }
62131
- // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
62132
- // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
62133
- // construct the type Box<T[X]>.
62134
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
62135
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62132
+ // If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
62133
+ // K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
62134
+ // For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
62135
+ if (isGenericMappedType(objectType)) {
62136
+ var nameType = getNameTypeFromMappedType(objectType);
62137
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
62138
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
62139
+ }
62136
62140
  }
62137
62141
  return type[cache] = type;
62138
62142
  }
@@ -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 = ts.versionMajorMinor + ".0-dev.20220416";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220419";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -33175,7 +33175,8 @@ var ts;
33175
33175
  var pos = getNodePos();
33176
33176
  parseExpected(112 /* TypeOfKeyword */);
33177
33177
  var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33178
- var typeArguments = tryParseTypeArguments();
33178
+ // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33179
+ var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33179
33180
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
33180
33181
  }
33181
33182
  function parseTypeParameter() {
@@ -61923,11 +61924,14 @@ var ts;
61923
61924
  return type[cache] = elementType;
61924
61925
  }
61925
61926
  }
61926
- // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
61927
- // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
61928
- // construct the type Box<T[X]>.
61929
- if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
61930
- return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61927
+ // If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
61928
+ // K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
61929
+ // For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
61930
+ if (isGenericMappedType(objectType)) {
61931
+ var nameType = getNameTypeFromMappedType(objectType);
61932
+ if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
61933
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61934
+ }
61931
61935
  }
61932
61936
  return type[cache] = type;
61933
61937
  }
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.7.0-dev.20220416",
5
+ "version": "4.7.0-dev.20220419",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [