typescript 4.8.0-dev.20220719 → 4.8.0-dev.20220722
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/lib.dom.d.ts +2 -2
- package/lib/lib.webworker.d.ts +2 -2
- package/lib/tsc.js +37 -25
- package/lib/tsserver.js +55 -29
- package/lib/tsserverlibrary.d.ts +6 -0
- package/lib/tsserverlibrary.js +55 -29
- package/lib/typescript.d.ts +6 -0
- package/lib/typescript.js +53 -29
- package/lib/typescriptServices.d.ts +6 -0
- package/lib/typescriptServices.js +53 -29
- package/lib/typingsInstaller.js +43 -25
- package/package.json +1 -1
package/lib/lib.dom.d.ts
CHANGED
|
@@ -13848,11 +13848,11 @@ declare var SubmitEvent: {
|
|
|
13848
13848
|
* Available only in secure contexts.
|
|
13849
13849
|
*/
|
|
13850
13850
|
interface SubtleCrypto {
|
|
13851
|
-
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<
|
|
13851
|
+
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
13852
13852
|
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
|
|
13853
13853
|
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
13854
13854
|
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
13855
|
-
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<
|
|
13855
|
+
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
13856
13856
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
13857
13857
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
13858
13858
|
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
package/lib/lib.webworker.d.ts
CHANGED
|
@@ -3008,11 +3008,11 @@ declare var StorageManager: {
|
|
|
3008
3008
|
* Available only in secure contexts.
|
|
3009
3009
|
*/
|
|
3010
3010
|
interface SubtleCrypto {
|
|
3011
|
-
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<
|
|
3011
|
+
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3012
3012
|
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
|
|
3013
3013
|
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
3014
3014
|
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
3015
|
-
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<
|
|
3015
|
+
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3016
3016
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
3017
3017
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3018
3018
|
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
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.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -28486,6 +28486,9 @@ var ts;
|
|
|
28486
28486
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
28487
28487
|
if (typeArguments !== undefined) {
|
|
28488
28488
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
28489
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
28490
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
28491
|
+
}
|
|
28489
28492
|
}
|
|
28490
28493
|
}
|
|
28491
28494
|
if (token() === 20 || token() === 24 || token() === 22) {
|
|
@@ -41382,7 +41385,7 @@ var ts;
|
|
|
41382
41385
|
}
|
|
41383
41386
|
}
|
|
41384
41387
|
function checkAndReportErrorForInvalidInitializer() {
|
|
41385
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
41388
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9)) {
|
|
41386
41389
|
error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos)
|
|
41387
41390
|
? ts.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor
|
|
41388
41391
|
: ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg));
|
|
@@ -49716,12 +49719,15 @@ var ts;
|
|
|
49716
49719
|
return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts.unescapeLeadingUnderscores(name)));
|
|
49717
49720
|
}
|
|
49718
49721
|
function getTypeParametersFromDeclaration(declaration) {
|
|
49722
|
+
var _a;
|
|
49719
49723
|
var result;
|
|
49720
|
-
for (var _i = 0,
|
|
49721
|
-
var node =
|
|
49724
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
49725
|
+
var node = _b[_i];
|
|
49722
49726
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
49723
49727
|
}
|
|
49724
|
-
return result
|
|
49728
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
49729
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
49730
|
+
: undefined;
|
|
49725
49731
|
}
|
|
49726
49732
|
function symbolsToArray(symbols) {
|
|
49727
49733
|
var result = [];
|
|
@@ -57767,15 +57773,11 @@ var ts;
|
|
|
57767
57773
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
57768
57774
|
}
|
|
57769
57775
|
else if (source.flags & 4194304 && target.flags & 4194304) {
|
|
57770
|
-
|
|
57771
|
-
inferFromTypes(source.type, target.type);
|
|
57772
|
-
contravariant = !contravariant;
|
|
57776
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
57773
57777
|
}
|
|
57774
57778
|
else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) {
|
|
57775
57779
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
57776
|
-
|
|
57777
|
-
inferWithPriority(empty, target.type, 256);
|
|
57778
|
-
contravariant = !contravariant;
|
|
57780
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256);
|
|
57779
57781
|
}
|
|
57780
57782
|
else if (source.flags & 8388608 && target.flags & 8388608) {
|
|
57781
57783
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -57788,10 +57790,7 @@ var ts;
|
|
|
57788
57790
|
}
|
|
57789
57791
|
else if (source.flags & 33554432) {
|
|
57790
57792
|
inferFromTypes(source.baseType, target);
|
|
57791
|
-
|
|
57792
|
-
priority |= 4;
|
|
57793
|
-
inferFromTypes(source.substitute, target);
|
|
57794
|
-
priority = oldPriority;
|
|
57793
|
+
inferWithPriority(source.substitute, target, 4);
|
|
57795
57794
|
}
|
|
57796
57795
|
else if (target.flags & 16777216) {
|
|
57797
57796
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -57830,6 +57829,18 @@ var ts;
|
|
|
57830
57829
|
inferFromTypes(source, target);
|
|
57831
57830
|
priority = savePriority;
|
|
57832
57831
|
}
|
|
57832
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
57833
|
+
var savePriority = priority;
|
|
57834
|
+
priority |= newPriority;
|
|
57835
|
+
inferFromContravariantTypes(source, target);
|
|
57836
|
+
priority = savePriority;
|
|
57837
|
+
}
|
|
57838
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
57839
|
+
var savePriority = priority;
|
|
57840
|
+
priority |= newPriority;
|
|
57841
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
57842
|
+
priority = savePriority;
|
|
57843
|
+
}
|
|
57833
57844
|
function invokeOnce(source, target, action) {
|
|
57834
57845
|
var key = source.id + "," + target.id;
|
|
57835
57846
|
var status = visited && visited.get(key);
|
|
@@ -57892,10 +57903,13 @@ var ts;
|
|
|
57892
57903
|
}
|
|
57893
57904
|
}
|
|
57894
57905
|
function inferFromContravariantTypes(source, target) {
|
|
57906
|
+
contravariant = !contravariant;
|
|
57907
|
+
inferFromTypes(source, target);
|
|
57908
|
+
contravariant = !contravariant;
|
|
57909
|
+
}
|
|
57910
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
57895
57911
|
if (strictFunctionTypes || priority & 1024) {
|
|
57896
|
-
|
|
57897
|
-
inferFromTypes(source, target);
|
|
57898
|
-
contravariant = !contravariant;
|
|
57912
|
+
inferFromContravariantTypes(source, target);
|
|
57899
57913
|
}
|
|
57900
57914
|
else {
|
|
57901
57915
|
inferFromTypes(source, target);
|
|
@@ -58026,11 +58040,8 @@ var ts;
|
|
|
58026
58040
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
58027
58041
|
}
|
|
58028
58042
|
else {
|
|
58029
|
-
var savePriority = priority;
|
|
58030
|
-
priority |= contravariant ? 64 : 0;
|
|
58031
58043
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
58032
|
-
|
|
58033
|
-
priority = savePriority;
|
|
58044
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 : 0);
|
|
58034
58045
|
}
|
|
58035
58046
|
}
|
|
58036
58047
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -58189,7 +58200,7 @@ var ts;
|
|
|
58189
58200
|
var saveBivariant = bivariant;
|
|
58190
58201
|
var kind = target.declaration ? target.declaration.kind : 0;
|
|
58191
58202
|
bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
|
|
58192
|
-
applyToParameterTypes(source, target,
|
|
58203
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
58193
58204
|
bivariant = saveBivariant;
|
|
58194
58205
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
58195
58206
|
}
|
|
@@ -64232,7 +64243,7 @@ var ts;
|
|
|
64232
64243
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
64233
64244
|
var reportErrors = !candidatesOutArray;
|
|
64234
64245
|
var typeArguments;
|
|
64235
|
-
if (!isDecorator) {
|
|
64246
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
64236
64247
|
typeArguments = node.typeArguments;
|
|
64237
64248
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) {
|
|
64238
64249
|
ts.forEach(typeArguments, checkSourceElement);
|
|
@@ -78633,7 +78644,8 @@ var ts;
|
|
|
78633
78644
|
else {
|
|
78634
78645
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
78635
78646
|
}
|
|
78636
|
-
|
|
78647
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
78648
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
78637
78649
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
78638
78650
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
|
|
78639
78651
|
ts.setTextRange(block, body);
|
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 = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -13217,6 +13217,12 @@ var ts;
|
|
|
13217
13217
|
/**
|
|
13218
13218
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13219
13219
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13220
|
+
*
|
|
13221
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13222
|
+
*
|
|
13223
|
+
* type Id = <T>(x: T) => T
|
|
13224
|
+
* /** @type {Id} /
|
|
13225
|
+
* function id(x) { return x }
|
|
13220
13226
|
*/
|
|
13221
13227
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13222
13228
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35477,6 +35483,9 @@ var ts;
|
|
|
35477
35483
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35478
35484
|
if (typeArguments !== undefined) {
|
|
35479
35485
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35486
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35487
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35488
|
+
}
|
|
35480
35489
|
}
|
|
35481
35490
|
}
|
|
35482
35491
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -50428,7 +50437,7 @@ var ts;
|
|
|
50428
50437
|
// 1. When result is undefined, after checking for a missing "this."
|
|
50429
50438
|
// 2. When result is defined
|
|
50430
50439
|
function checkAndReportErrorForInvalidInitializer() {
|
|
50431
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
50440
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
50432
50441
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
50433
50442
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
50434
50443
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -59998,12 +60007,15 @@ var ts;
|
|
|
59998
60007
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
59999
60008
|
// type checking functions).
|
|
60000
60009
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60010
|
+
var _a;
|
|
60001
60011
|
var result;
|
|
60002
|
-
for (var _i = 0,
|
|
60003
|
-
var node =
|
|
60012
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60013
|
+
var node = _b[_i];
|
|
60004
60014
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
60005
60015
|
}
|
|
60006
|
-
return result
|
|
60016
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60017
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60018
|
+
: undefined;
|
|
60007
60019
|
}
|
|
60008
60020
|
function symbolsToArray(symbols) {
|
|
60009
60021
|
var result = [];
|
|
@@ -69224,15 +69236,11 @@ var ts;
|
|
|
69224
69236
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69225
69237
|
}
|
|
69226
69238
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69227
|
-
|
|
69228
|
-
inferFromTypes(source.type, target.type);
|
|
69229
|
-
contravariant = !contravariant;
|
|
69239
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69230
69240
|
}
|
|
69231
69241
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69232
69242
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69233
|
-
|
|
69234
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69235
|
-
contravariant = !contravariant;
|
|
69243
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69236
69244
|
}
|
|
69237
69245
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69238
69246
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69245,10 +69253,7 @@ var ts;
|
|
|
69245
69253
|
}
|
|
69246
69254
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69247
69255
|
inferFromTypes(source.baseType, target);
|
|
69248
|
-
|
|
69249
|
-
priority |= 4 /* SubstituteSource */;
|
|
69250
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69251
|
-
priority = oldPriority;
|
|
69256
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69252
69257
|
}
|
|
69253
69258
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69254
69259
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69298,6 +69303,18 @@ var ts;
|
|
|
69298
69303
|
inferFromTypes(source, target);
|
|
69299
69304
|
priority = savePriority;
|
|
69300
69305
|
}
|
|
69306
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69307
|
+
var savePriority = priority;
|
|
69308
|
+
priority |= newPriority;
|
|
69309
|
+
inferFromContravariantTypes(source, target);
|
|
69310
|
+
priority = savePriority;
|
|
69311
|
+
}
|
|
69312
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69313
|
+
var savePriority = priority;
|
|
69314
|
+
priority |= newPriority;
|
|
69315
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69316
|
+
priority = savePriority;
|
|
69317
|
+
}
|
|
69301
69318
|
function invokeOnce(source, target, action) {
|
|
69302
69319
|
var key = source.id + "," + target.id;
|
|
69303
69320
|
var status = visited && visited.get(key);
|
|
@@ -69362,10 +69379,13 @@ var ts;
|
|
|
69362
69379
|
}
|
|
69363
69380
|
}
|
|
69364
69381
|
function inferFromContravariantTypes(source, target) {
|
|
69382
|
+
contravariant = !contravariant;
|
|
69383
|
+
inferFromTypes(source, target);
|
|
69384
|
+
contravariant = !contravariant;
|
|
69385
|
+
}
|
|
69386
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69365
69387
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69366
|
-
|
|
69367
|
-
inferFromTypes(source, target);
|
|
69368
|
-
contravariant = !contravariant;
|
|
69388
|
+
inferFromContravariantTypes(source, target);
|
|
69369
69389
|
}
|
|
69370
69390
|
else {
|
|
69371
69391
|
inferFromTypes(source, target);
|
|
@@ -69529,11 +69549,8 @@ var ts;
|
|
|
69529
69549
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69530
69550
|
}
|
|
69531
69551
|
else {
|
|
69532
|
-
var savePriority = priority;
|
|
69533
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69534
69552
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69535
|
-
|
|
69536
|
-
priority = savePriority;
|
|
69553
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69537
69554
|
}
|
|
69538
69555
|
}
|
|
69539
69556
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69719,7 +69736,7 @@ var ts;
|
|
|
69719
69736
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69720
69737
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69721
69738
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69722
|
-
applyToParameterTypes(source, target,
|
|
69739
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69723
69740
|
bivariant = saveBivariant;
|
|
69724
69741
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69725
69742
|
}
|
|
@@ -76761,7 +76778,7 @@ var ts;
|
|
|
76761
76778
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76762
76779
|
var reportErrors = !candidatesOutArray;
|
|
76763
76780
|
var typeArguments;
|
|
76764
|
-
if (!isDecorator) {
|
|
76781
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76765
76782
|
typeArguments = node.typeArguments;
|
|
76766
76783
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76767
76784
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -93495,7 +93512,8 @@ var ts;
|
|
|
93495
93512
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
93496
93513
|
}
|
|
93497
93514
|
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
93498
|
-
|
|
93515
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
93516
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
93499
93517
|
// End the lexical environment.
|
|
93500
93518
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
93501
93519
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -141741,8 +141759,12 @@ var ts;
|
|
|
141741
141759
|
return undefined;
|
|
141742
141760
|
}
|
|
141743
141761
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
141744
|
-
var
|
|
141745
|
-
|
|
141762
|
+
var commentOwnerJsDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? commentOwner.jsDoc : undefined;
|
|
141763
|
+
var lastJsDoc = ts.lastOrUndefined(commentOwnerJsDoc);
|
|
141764
|
+
if (commentOwner.getStart(sourceFile) < position
|
|
141765
|
+
|| lastJsDoc
|
|
141766
|
+
&& existingDocComment
|
|
141767
|
+
&& lastJsDoc !== existingDocComment) {
|
|
141746
141768
|
return undefined;
|
|
141747
141769
|
}
|
|
141748
141770
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -141759,7 +141781,9 @@ var ts;
|
|
|
141759
141781
|
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
|
141760
141782
|
var openComment = "/**";
|
|
141761
141783
|
var closeComment = " */";
|
|
141762
|
-
|
|
141784
|
+
// If any of the existing jsDoc has tags, ignore adding new ones.
|
|
141785
|
+
var hasTag = (commentOwnerJsDoc || []).some(function (jsDoc) { return !!jsDoc.tags; });
|
|
141786
|
+
if (tags && !hasTag) {
|
|
141763
141787
|
var preamble = openComment + newLine + indentationStr + " * ";
|
|
141764
141788
|
var endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
141765
141789
|
var result = preamble + newLine + tags + indentationStr + closeComment + endLine;
|
|
@@ -161867,7 +161891,7 @@ var ts;
|
|
|
161867
161891
|
var savedPermittedJumps = permittedJumps;
|
|
161868
161892
|
switch (node.kind) {
|
|
161869
161893
|
case 239 /* IfStatement */:
|
|
161870
|
-
permittedJumps
|
|
161894
|
+
permittedJumps &= ~4 /* Return */;
|
|
161871
161895
|
break;
|
|
161872
161896
|
case 252 /* TryStatement */:
|
|
161873
161897
|
// forbid all jumps inside try blocks
|
|
@@ -177000,6 +177024,8 @@ var ts;
|
|
|
177000
177024
|
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
177001
177025
|
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
|
|
177002
177026
|
var info = infos && ts.firstOrUndefined(infos);
|
|
177027
|
+
// Note that the value of `isLocal` may depend on whether or not the checker has run on the containing file
|
|
177028
|
+
// (implying that FAR cascading behavior may depend on request order)
|
|
177003
177029
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
177004
177030
|
}
|
|
177005
177031
|
function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -4464,6 +4464,12 @@ declare namespace ts {
|
|
|
4464
4464
|
/**
|
|
4465
4465
|
* Gets the effective type parameters. If the node was parsed in a
|
|
4466
4466
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
4467
|
+
*
|
|
4468
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
4469
|
+
*
|
|
4470
|
+
* type Id = <T>(x: T) => T
|
|
4471
|
+
* /** @type {Id} /
|
|
4472
|
+
* function id(x) { return x }
|
|
4467
4473
|
*/
|
|
4468
4474
|
function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): readonly TypeParameterDeclaration[];
|
|
4469
4475
|
function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -13411,6 +13411,12 @@ var ts;
|
|
|
13411
13411
|
/**
|
|
13412
13412
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13413
13413
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13414
|
+
*
|
|
13415
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13416
|
+
*
|
|
13417
|
+
* type Id = <T>(x: T) => T
|
|
13418
|
+
* /** @type {Id} /
|
|
13419
|
+
* function id(x) { return x }
|
|
13414
13420
|
*/
|
|
13415
13421
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13416
13422
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35671,6 +35677,9 @@ var ts;
|
|
|
35671
35677
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35672
35678
|
if (typeArguments !== undefined) {
|
|
35673
35679
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35680
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35681
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35682
|
+
}
|
|
35674
35683
|
}
|
|
35675
35684
|
}
|
|
35676
35685
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -50622,7 +50631,7 @@ var ts;
|
|
|
50622
50631
|
// 1. When result is undefined, after checking for a missing "this."
|
|
50623
50632
|
// 2. When result is defined
|
|
50624
50633
|
function checkAndReportErrorForInvalidInitializer() {
|
|
50625
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
50634
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
50626
50635
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
50627
50636
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
50628
50637
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -60192,12 +60201,15 @@ var ts;
|
|
|
60192
60201
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
60193
60202
|
// type checking functions).
|
|
60194
60203
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60204
|
+
var _a;
|
|
60195
60205
|
var result;
|
|
60196
|
-
for (var _i = 0,
|
|
60197
|
-
var node =
|
|
60206
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60207
|
+
var node = _b[_i];
|
|
60198
60208
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
60199
60209
|
}
|
|
60200
|
-
return result
|
|
60210
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60211
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60212
|
+
: undefined;
|
|
60201
60213
|
}
|
|
60202
60214
|
function symbolsToArray(symbols) {
|
|
60203
60215
|
var result = [];
|
|
@@ -69418,15 +69430,11 @@ var ts;
|
|
|
69418
69430
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69419
69431
|
}
|
|
69420
69432
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69421
|
-
|
|
69422
|
-
inferFromTypes(source.type, target.type);
|
|
69423
|
-
contravariant = !contravariant;
|
|
69433
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69424
69434
|
}
|
|
69425
69435
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69426
69436
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69427
|
-
|
|
69428
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69429
|
-
contravariant = !contravariant;
|
|
69437
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69430
69438
|
}
|
|
69431
69439
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69432
69440
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69439,10 +69447,7 @@ var ts;
|
|
|
69439
69447
|
}
|
|
69440
69448
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69441
69449
|
inferFromTypes(source.baseType, target);
|
|
69442
|
-
|
|
69443
|
-
priority |= 4 /* SubstituteSource */;
|
|
69444
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69445
|
-
priority = oldPriority;
|
|
69450
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69446
69451
|
}
|
|
69447
69452
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69448
69453
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69492,6 +69497,18 @@ var ts;
|
|
|
69492
69497
|
inferFromTypes(source, target);
|
|
69493
69498
|
priority = savePriority;
|
|
69494
69499
|
}
|
|
69500
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69501
|
+
var savePriority = priority;
|
|
69502
|
+
priority |= newPriority;
|
|
69503
|
+
inferFromContravariantTypes(source, target);
|
|
69504
|
+
priority = savePriority;
|
|
69505
|
+
}
|
|
69506
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69507
|
+
var savePriority = priority;
|
|
69508
|
+
priority |= newPriority;
|
|
69509
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69510
|
+
priority = savePriority;
|
|
69511
|
+
}
|
|
69495
69512
|
function invokeOnce(source, target, action) {
|
|
69496
69513
|
var key = source.id + "," + target.id;
|
|
69497
69514
|
var status = visited && visited.get(key);
|
|
@@ -69556,10 +69573,13 @@ var ts;
|
|
|
69556
69573
|
}
|
|
69557
69574
|
}
|
|
69558
69575
|
function inferFromContravariantTypes(source, target) {
|
|
69576
|
+
contravariant = !contravariant;
|
|
69577
|
+
inferFromTypes(source, target);
|
|
69578
|
+
contravariant = !contravariant;
|
|
69579
|
+
}
|
|
69580
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69559
69581
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69560
|
-
|
|
69561
|
-
inferFromTypes(source, target);
|
|
69562
|
-
contravariant = !contravariant;
|
|
69582
|
+
inferFromContravariantTypes(source, target);
|
|
69563
69583
|
}
|
|
69564
69584
|
else {
|
|
69565
69585
|
inferFromTypes(source, target);
|
|
@@ -69723,11 +69743,8 @@ var ts;
|
|
|
69723
69743
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69724
69744
|
}
|
|
69725
69745
|
else {
|
|
69726
|
-
var savePriority = priority;
|
|
69727
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69728
69746
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69729
|
-
|
|
69730
|
-
priority = savePriority;
|
|
69747
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69731
69748
|
}
|
|
69732
69749
|
}
|
|
69733
69750
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69913,7 +69930,7 @@ var ts;
|
|
|
69913
69930
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69914
69931
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69915
69932
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69916
|
-
applyToParameterTypes(source, target,
|
|
69933
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69917
69934
|
bivariant = saveBivariant;
|
|
69918
69935
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69919
69936
|
}
|
|
@@ -76955,7 +76972,7 @@ var ts;
|
|
|
76955
76972
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76956
76973
|
var reportErrors = !candidatesOutArray;
|
|
76957
76974
|
var typeArguments;
|
|
76958
|
-
if (!isDecorator) {
|
|
76975
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76959
76976
|
typeArguments = node.typeArguments;
|
|
76960
76977
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76961
76978
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -93689,7 +93706,8 @@ var ts;
|
|
|
93689
93706
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
93690
93707
|
}
|
|
93691
93708
|
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
93692
|
-
|
|
93709
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
93710
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
93693
93711
|
// End the lexical environment.
|
|
93694
93712
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
93695
93713
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -142354,8 +142372,12 @@ var ts;
|
|
|
142354
142372
|
return undefined;
|
|
142355
142373
|
}
|
|
142356
142374
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
142357
|
-
var
|
|
142358
|
-
|
|
142375
|
+
var commentOwnerJsDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? commentOwner.jsDoc : undefined;
|
|
142376
|
+
var lastJsDoc = ts.lastOrUndefined(commentOwnerJsDoc);
|
|
142377
|
+
if (commentOwner.getStart(sourceFile) < position
|
|
142378
|
+
|| lastJsDoc
|
|
142379
|
+
&& existingDocComment
|
|
142380
|
+
&& lastJsDoc !== existingDocComment) {
|
|
142359
142381
|
return undefined;
|
|
142360
142382
|
}
|
|
142361
142383
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -142372,7 +142394,9 @@ var ts;
|
|
|
142372
142394
|
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
|
142373
142395
|
var openComment = "/**";
|
|
142374
142396
|
var closeComment = " */";
|
|
142375
|
-
|
|
142397
|
+
// If any of the existing jsDoc has tags, ignore adding new ones.
|
|
142398
|
+
var hasTag = (commentOwnerJsDoc || []).some(function (jsDoc) { return !!jsDoc.tags; });
|
|
142399
|
+
if (tags && !hasTag) {
|
|
142376
142400
|
var preamble = openComment + newLine + indentationStr + " * ";
|
|
142377
142401
|
var endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
142378
142402
|
var result = preamble + newLine + tags + indentationStr + closeComment + endLine;
|
|
@@ -162480,7 +162504,7 @@ var ts;
|
|
|
162480
162504
|
var savedPermittedJumps = permittedJumps;
|
|
162481
162505
|
switch (node.kind) {
|
|
162482
162506
|
case 239 /* IfStatement */:
|
|
162483
|
-
permittedJumps
|
|
162507
|
+
permittedJumps &= ~4 /* Return */;
|
|
162484
162508
|
break;
|
|
162485
162509
|
case 252 /* TryStatement */:
|
|
162486
162510
|
// forbid all jumps inside try blocks
|
|
@@ -177194,6 +177218,8 @@ var ts;
|
|
|
177194
177218
|
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
177195
177219
|
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
|
|
177196
177220
|
var info = infos && ts.firstOrUndefined(infos);
|
|
177221
|
+
// Note that the value of `isLocal` may depend on whether or not the checker has run on the containing file
|
|
177222
|
+
// (implying that FAR cascading behavior may depend on request order)
|
|
177197
177223
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
177198
177224
|
}
|
|
177199
177225
|
function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -4464,6 +4464,12 @@ declare namespace ts {
|
|
|
4464
4464
|
/**
|
|
4465
4465
|
* Gets the effective type parameters. If the node was parsed in a
|
|
4466
4466
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
4467
|
+
*
|
|
4468
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
4469
|
+
*
|
|
4470
|
+
* type Id = <T>(x: T) => T
|
|
4471
|
+
* /** @type {Id} /
|
|
4472
|
+
* function id(x) { return x }
|
|
4467
4473
|
*/
|
|
4468
4474
|
function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): readonly TypeParameterDeclaration[];
|
|
4469
4475
|
function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
|
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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -13402,6 +13402,12 @@ var ts;
|
|
|
13402
13402
|
/**
|
|
13403
13403
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13404
13404
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13405
|
+
*
|
|
13406
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13407
|
+
*
|
|
13408
|
+
* type Id = <T>(x: T) => T
|
|
13409
|
+
* /** @type {Id} /
|
|
13410
|
+
* function id(x) { return x }
|
|
13405
13411
|
*/
|
|
13406
13412
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13407
13413
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35662,6 +35668,9 @@ var ts;
|
|
|
35662
35668
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35663
35669
|
if (typeArguments !== undefined) {
|
|
35664
35670
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35671
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35672
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35673
|
+
}
|
|
35665
35674
|
}
|
|
35666
35675
|
}
|
|
35667
35676
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -50613,7 +50622,7 @@ var ts;
|
|
|
50613
50622
|
// 1. When result is undefined, after checking for a missing "this."
|
|
50614
50623
|
// 2. When result is defined
|
|
50615
50624
|
function checkAndReportErrorForInvalidInitializer() {
|
|
50616
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
50625
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
50617
50626
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
50618
50627
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
50619
50628
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -60183,12 +60192,15 @@ var ts;
|
|
|
60183
60192
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
60184
60193
|
// type checking functions).
|
|
60185
60194
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60195
|
+
var _a;
|
|
60186
60196
|
var result;
|
|
60187
|
-
for (var _i = 0,
|
|
60188
|
-
var node =
|
|
60197
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60198
|
+
var node = _b[_i];
|
|
60189
60199
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
60190
60200
|
}
|
|
60191
|
-
return result
|
|
60201
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60202
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60203
|
+
: undefined;
|
|
60192
60204
|
}
|
|
60193
60205
|
function symbolsToArray(symbols) {
|
|
60194
60206
|
var result = [];
|
|
@@ -69409,15 +69421,11 @@ var ts;
|
|
|
69409
69421
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69410
69422
|
}
|
|
69411
69423
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69412
|
-
|
|
69413
|
-
inferFromTypes(source.type, target.type);
|
|
69414
|
-
contravariant = !contravariant;
|
|
69424
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69415
69425
|
}
|
|
69416
69426
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69417
69427
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69418
|
-
|
|
69419
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69420
|
-
contravariant = !contravariant;
|
|
69428
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69421
69429
|
}
|
|
69422
69430
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69423
69431
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69430,10 +69438,7 @@ var ts;
|
|
|
69430
69438
|
}
|
|
69431
69439
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69432
69440
|
inferFromTypes(source.baseType, target);
|
|
69433
|
-
|
|
69434
|
-
priority |= 4 /* SubstituteSource */;
|
|
69435
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69436
|
-
priority = oldPriority;
|
|
69441
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69437
69442
|
}
|
|
69438
69443
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69439
69444
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69483,6 +69488,18 @@ var ts;
|
|
|
69483
69488
|
inferFromTypes(source, target);
|
|
69484
69489
|
priority = savePriority;
|
|
69485
69490
|
}
|
|
69491
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69492
|
+
var savePriority = priority;
|
|
69493
|
+
priority |= newPriority;
|
|
69494
|
+
inferFromContravariantTypes(source, target);
|
|
69495
|
+
priority = savePriority;
|
|
69496
|
+
}
|
|
69497
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69498
|
+
var savePriority = priority;
|
|
69499
|
+
priority |= newPriority;
|
|
69500
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69501
|
+
priority = savePriority;
|
|
69502
|
+
}
|
|
69486
69503
|
function invokeOnce(source, target, action) {
|
|
69487
69504
|
var key = source.id + "," + target.id;
|
|
69488
69505
|
var status = visited && visited.get(key);
|
|
@@ -69547,10 +69564,13 @@ var ts;
|
|
|
69547
69564
|
}
|
|
69548
69565
|
}
|
|
69549
69566
|
function inferFromContravariantTypes(source, target) {
|
|
69567
|
+
contravariant = !contravariant;
|
|
69568
|
+
inferFromTypes(source, target);
|
|
69569
|
+
contravariant = !contravariant;
|
|
69570
|
+
}
|
|
69571
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69550
69572
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69551
|
-
|
|
69552
|
-
inferFromTypes(source, target);
|
|
69553
|
-
contravariant = !contravariant;
|
|
69573
|
+
inferFromContravariantTypes(source, target);
|
|
69554
69574
|
}
|
|
69555
69575
|
else {
|
|
69556
69576
|
inferFromTypes(source, target);
|
|
@@ -69714,11 +69734,8 @@ var ts;
|
|
|
69714
69734
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69715
69735
|
}
|
|
69716
69736
|
else {
|
|
69717
|
-
var savePriority = priority;
|
|
69718
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69719
69737
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69720
|
-
|
|
69721
|
-
priority = savePriority;
|
|
69738
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69722
69739
|
}
|
|
69723
69740
|
}
|
|
69724
69741
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69904,7 +69921,7 @@ var ts;
|
|
|
69904
69921
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69905
69922
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69906
69923
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69907
|
-
applyToParameterTypes(source, target,
|
|
69924
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69908
69925
|
bivariant = saveBivariant;
|
|
69909
69926
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69910
69927
|
}
|
|
@@ -76946,7 +76963,7 @@ var ts;
|
|
|
76946
76963
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76947
76964
|
var reportErrors = !candidatesOutArray;
|
|
76948
76965
|
var typeArguments;
|
|
76949
|
-
if (!isDecorator) {
|
|
76966
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76950
76967
|
typeArguments = node.typeArguments;
|
|
76951
76968
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76952
76969
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -93680,7 +93697,8 @@ var ts;
|
|
|
93680
93697
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
93681
93698
|
}
|
|
93682
93699
|
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
93683
|
-
|
|
93700
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
93701
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
93684
93702
|
// End the lexical environment.
|
|
93685
93703
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
93686
93704
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -142345,8 +142363,12 @@ var ts;
|
|
|
142345
142363
|
return undefined;
|
|
142346
142364
|
}
|
|
142347
142365
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
142348
|
-
var
|
|
142349
|
-
|
|
142366
|
+
var commentOwnerJsDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? commentOwner.jsDoc : undefined;
|
|
142367
|
+
var lastJsDoc = ts.lastOrUndefined(commentOwnerJsDoc);
|
|
142368
|
+
if (commentOwner.getStart(sourceFile) < position
|
|
142369
|
+
|| lastJsDoc
|
|
142370
|
+
&& existingDocComment
|
|
142371
|
+
&& lastJsDoc !== existingDocComment) {
|
|
142350
142372
|
return undefined;
|
|
142351
142373
|
}
|
|
142352
142374
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -142363,7 +142385,9 @@ var ts;
|
|
|
142363
142385
|
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
|
142364
142386
|
var openComment = "/**";
|
|
142365
142387
|
var closeComment = " */";
|
|
142366
|
-
|
|
142388
|
+
// If any of the existing jsDoc has tags, ignore adding new ones.
|
|
142389
|
+
var hasTag = (commentOwnerJsDoc || []).some(function (jsDoc) { return !!jsDoc.tags; });
|
|
142390
|
+
if (tags && !hasTag) {
|
|
142367
142391
|
var preamble = openComment + newLine + indentationStr + " * ";
|
|
142368
142392
|
var endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
142369
142393
|
var result = preamble + newLine + tags + indentationStr + closeComment + endLine;
|
|
@@ -162471,7 +162495,7 @@ var ts;
|
|
|
162471
162495
|
var savedPermittedJumps = permittedJumps;
|
|
162472
162496
|
switch (node.kind) {
|
|
162473
162497
|
case 239 /* IfStatement */:
|
|
162474
|
-
permittedJumps
|
|
162498
|
+
permittedJumps &= ~4 /* Return */;
|
|
162475
162499
|
break;
|
|
162476
162500
|
case 252 /* TryStatement */:
|
|
162477
162501
|
// forbid all jumps inside try blocks
|
|
@@ -4464,6 +4464,12 @@ declare namespace ts {
|
|
|
4464
4464
|
/**
|
|
4465
4465
|
* Gets the effective type parameters. If the node was parsed in a
|
|
4466
4466
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
4467
|
+
*
|
|
4468
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
4469
|
+
*
|
|
4470
|
+
* type Id = <T>(x: T) => T
|
|
4471
|
+
* /** @type {Id} /
|
|
4472
|
+
* function id(x) { return x }
|
|
4467
4473
|
*/
|
|
4468
4474
|
function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): readonly TypeParameterDeclaration[];
|
|
4469
4475
|
function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
|
|
@@ -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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -13402,6 +13402,12 @@ var ts;
|
|
|
13402
13402
|
/**
|
|
13403
13403
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13404
13404
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13405
|
+
*
|
|
13406
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13407
|
+
*
|
|
13408
|
+
* type Id = <T>(x: T) => T
|
|
13409
|
+
* /** @type {Id} /
|
|
13410
|
+
* function id(x) { return x }
|
|
13405
13411
|
*/
|
|
13406
13412
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13407
13413
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35662,6 +35668,9 @@ var ts;
|
|
|
35662
35668
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35663
35669
|
if (typeArguments !== undefined) {
|
|
35664
35670
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35671
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35672
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35673
|
+
}
|
|
35665
35674
|
}
|
|
35666
35675
|
}
|
|
35667
35676
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -50613,7 +50622,7 @@ var ts;
|
|
|
50613
50622
|
// 1. When result is undefined, after checking for a missing "this."
|
|
50614
50623
|
// 2. When result is defined
|
|
50615
50624
|
function checkAndReportErrorForInvalidInitializer() {
|
|
50616
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
50625
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
50617
50626
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
50618
50627
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
50619
50628
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -60183,12 +60192,15 @@ var ts;
|
|
|
60183
60192
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
60184
60193
|
// type checking functions).
|
|
60185
60194
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60195
|
+
var _a;
|
|
60186
60196
|
var result;
|
|
60187
|
-
for (var _i = 0,
|
|
60188
|
-
var node =
|
|
60197
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60198
|
+
var node = _b[_i];
|
|
60189
60199
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
60190
60200
|
}
|
|
60191
|
-
return result
|
|
60201
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60202
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60203
|
+
: undefined;
|
|
60192
60204
|
}
|
|
60193
60205
|
function symbolsToArray(symbols) {
|
|
60194
60206
|
var result = [];
|
|
@@ -69409,15 +69421,11 @@ var ts;
|
|
|
69409
69421
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69410
69422
|
}
|
|
69411
69423
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69412
|
-
|
|
69413
|
-
inferFromTypes(source.type, target.type);
|
|
69414
|
-
contravariant = !contravariant;
|
|
69424
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69415
69425
|
}
|
|
69416
69426
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69417
69427
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69418
|
-
|
|
69419
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69420
|
-
contravariant = !contravariant;
|
|
69428
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69421
69429
|
}
|
|
69422
69430
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69423
69431
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69430,10 +69438,7 @@ var ts;
|
|
|
69430
69438
|
}
|
|
69431
69439
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69432
69440
|
inferFromTypes(source.baseType, target);
|
|
69433
|
-
|
|
69434
|
-
priority |= 4 /* SubstituteSource */;
|
|
69435
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69436
|
-
priority = oldPriority;
|
|
69441
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69437
69442
|
}
|
|
69438
69443
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69439
69444
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69483,6 +69488,18 @@ var ts;
|
|
|
69483
69488
|
inferFromTypes(source, target);
|
|
69484
69489
|
priority = savePriority;
|
|
69485
69490
|
}
|
|
69491
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69492
|
+
var savePriority = priority;
|
|
69493
|
+
priority |= newPriority;
|
|
69494
|
+
inferFromContravariantTypes(source, target);
|
|
69495
|
+
priority = savePriority;
|
|
69496
|
+
}
|
|
69497
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69498
|
+
var savePriority = priority;
|
|
69499
|
+
priority |= newPriority;
|
|
69500
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69501
|
+
priority = savePriority;
|
|
69502
|
+
}
|
|
69486
69503
|
function invokeOnce(source, target, action) {
|
|
69487
69504
|
var key = source.id + "," + target.id;
|
|
69488
69505
|
var status = visited && visited.get(key);
|
|
@@ -69547,10 +69564,13 @@ var ts;
|
|
|
69547
69564
|
}
|
|
69548
69565
|
}
|
|
69549
69566
|
function inferFromContravariantTypes(source, target) {
|
|
69567
|
+
contravariant = !contravariant;
|
|
69568
|
+
inferFromTypes(source, target);
|
|
69569
|
+
contravariant = !contravariant;
|
|
69570
|
+
}
|
|
69571
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69550
69572
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69551
|
-
|
|
69552
|
-
inferFromTypes(source, target);
|
|
69553
|
-
contravariant = !contravariant;
|
|
69573
|
+
inferFromContravariantTypes(source, target);
|
|
69554
69574
|
}
|
|
69555
69575
|
else {
|
|
69556
69576
|
inferFromTypes(source, target);
|
|
@@ -69714,11 +69734,8 @@ var ts;
|
|
|
69714
69734
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69715
69735
|
}
|
|
69716
69736
|
else {
|
|
69717
|
-
var savePriority = priority;
|
|
69718
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69719
69737
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69720
|
-
|
|
69721
|
-
priority = savePriority;
|
|
69738
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69722
69739
|
}
|
|
69723
69740
|
}
|
|
69724
69741
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69904,7 +69921,7 @@ var ts;
|
|
|
69904
69921
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69905
69922
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69906
69923
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69907
|
-
applyToParameterTypes(source, target,
|
|
69924
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69908
69925
|
bivariant = saveBivariant;
|
|
69909
69926
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69910
69927
|
}
|
|
@@ -76946,7 +76963,7 @@ var ts;
|
|
|
76946
76963
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76947
76964
|
var reportErrors = !candidatesOutArray;
|
|
76948
76965
|
var typeArguments;
|
|
76949
|
-
if (!isDecorator) {
|
|
76966
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76950
76967
|
typeArguments = node.typeArguments;
|
|
76951
76968
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76952
76969
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -93680,7 +93697,8 @@ var ts;
|
|
|
93680
93697
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
93681
93698
|
}
|
|
93682
93699
|
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
93683
|
-
|
|
93700
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
93701
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
93684
93702
|
// End the lexical environment.
|
|
93685
93703
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
93686
93704
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -142345,8 +142363,12 @@ var ts;
|
|
|
142345
142363
|
return undefined;
|
|
142346
142364
|
}
|
|
142347
142365
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
142348
|
-
var
|
|
142349
|
-
|
|
142366
|
+
var commentOwnerJsDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? commentOwner.jsDoc : undefined;
|
|
142367
|
+
var lastJsDoc = ts.lastOrUndefined(commentOwnerJsDoc);
|
|
142368
|
+
if (commentOwner.getStart(sourceFile) < position
|
|
142369
|
+
|| lastJsDoc
|
|
142370
|
+
&& existingDocComment
|
|
142371
|
+
&& lastJsDoc !== existingDocComment) {
|
|
142350
142372
|
return undefined;
|
|
142351
142373
|
}
|
|
142352
142374
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -142363,7 +142385,9 @@ var ts;
|
|
|
142363
142385
|
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
|
142364
142386
|
var openComment = "/**";
|
|
142365
142387
|
var closeComment = " */";
|
|
142366
|
-
|
|
142388
|
+
// If any of the existing jsDoc has tags, ignore adding new ones.
|
|
142389
|
+
var hasTag = (commentOwnerJsDoc || []).some(function (jsDoc) { return !!jsDoc.tags; });
|
|
142390
|
+
if (tags && !hasTag) {
|
|
142367
142391
|
var preamble = openComment + newLine + indentationStr + " * ";
|
|
142368
142392
|
var endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
142369
142393
|
var result = preamble + newLine + tags + indentationStr + closeComment + endLine;
|
|
@@ -162471,7 +162495,7 @@ var ts;
|
|
|
162471
162495
|
var savedPermittedJumps = permittedJumps;
|
|
162472
162496
|
switch (node.kind) {
|
|
162473
162497
|
case 239 /* IfStatement */:
|
|
162474
|
-
permittedJumps
|
|
162498
|
+
permittedJumps &= ~4 /* Return */;
|
|
162475
162499
|
break;
|
|
162476
162500
|
case 252 /* TryStatement */:
|
|
162477
162501
|
// forbid all jumps inside try blocks
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -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.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220722";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -13197,6 +13197,12 @@ var ts;
|
|
|
13197
13197
|
/**
|
|
13198
13198
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13199
13199
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13200
|
+
*
|
|
13201
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13202
|
+
*
|
|
13203
|
+
* type Id = <T>(x: T) => T
|
|
13204
|
+
* /** @type {Id} /
|
|
13205
|
+
* function id(x) { return x }
|
|
13200
13206
|
*/
|
|
13201
13207
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13202
13208
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35457,6 +35463,9 @@ var ts;
|
|
|
35457
35463
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35458
35464
|
if (typeArguments !== undefined) {
|
|
35459
35465
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35466
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35467
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35468
|
+
}
|
|
35460
35469
|
}
|
|
35461
35470
|
}
|
|
35462
35471
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -50408,7 +50417,7 @@ var ts;
|
|
|
50408
50417
|
// 1. When result is undefined, after checking for a missing "this."
|
|
50409
50418
|
// 2. When result is defined
|
|
50410
50419
|
function checkAndReportErrorForInvalidInitializer() {
|
|
50411
|
-
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions)
|
|
50420
|
+
if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
50412
50421
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
50413
50422
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
50414
50423
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -59978,12 +59987,15 @@ var ts;
|
|
|
59978
59987
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
59979
59988
|
// type checking functions).
|
|
59980
59989
|
function getTypeParametersFromDeclaration(declaration) {
|
|
59990
|
+
var _a;
|
|
59981
59991
|
var result;
|
|
59982
|
-
for (var _i = 0,
|
|
59983
|
-
var node =
|
|
59992
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
59993
|
+
var node = _b[_i];
|
|
59984
59994
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
59985
59995
|
}
|
|
59986
|
-
return result
|
|
59996
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
59997
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
59998
|
+
: undefined;
|
|
59987
59999
|
}
|
|
59988
60000
|
function symbolsToArray(symbols) {
|
|
59989
60001
|
var result = [];
|
|
@@ -69204,15 +69216,11 @@ var ts;
|
|
|
69204
69216
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69205
69217
|
}
|
|
69206
69218
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69207
|
-
|
|
69208
|
-
inferFromTypes(source.type, target.type);
|
|
69209
|
-
contravariant = !contravariant;
|
|
69219
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69210
69220
|
}
|
|
69211
69221
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69212
69222
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69213
|
-
|
|
69214
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69215
|
-
contravariant = !contravariant;
|
|
69223
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69216
69224
|
}
|
|
69217
69225
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69218
69226
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69225,10 +69233,7 @@ var ts;
|
|
|
69225
69233
|
}
|
|
69226
69234
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69227
69235
|
inferFromTypes(source.baseType, target);
|
|
69228
|
-
|
|
69229
|
-
priority |= 4 /* SubstituteSource */;
|
|
69230
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69231
|
-
priority = oldPriority;
|
|
69236
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69232
69237
|
}
|
|
69233
69238
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69234
69239
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69278,6 +69283,18 @@ var ts;
|
|
|
69278
69283
|
inferFromTypes(source, target);
|
|
69279
69284
|
priority = savePriority;
|
|
69280
69285
|
}
|
|
69286
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69287
|
+
var savePriority = priority;
|
|
69288
|
+
priority |= newPriority;
|
|
69289
|
+
inferFromContravariantTypes(source, target);
|
|
69290
|
+
priority = savePriority;
|
|
69291
|
+
}
|
|
69292
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69293
|
+
var savePriority = priority;
|
|
69294
|
+
priority |= newPriority;
|
|
69295
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69296
|
+
priority = savePriority;
|
|
69297
|
+
}
|
|
69281
69298
|
function invokeOnce(source, target, action) {
|
|
69282
69299
|
var key = source.id + "," + target.id;
|
|
69283
69300
|
var status = visited && visited.get(key);
|
|
@@ -69342,10 +69359,13 @@ var ts;
|
|
|
69342
69359
|
}
|
|
69343
69360
|
}
|
|
69344
69361
|
function inferFromContravariantTypes(source, target) {
|
|
69362
|
+
contravariant = !contravariant;
|
|
69363
|
+
inferFromTypes(source, target);
|
|
69364
|
+
contravariant = !contravariant;
|
|
69365
|
+
}
|
|
69366
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69345
69367
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69346
|
-
|
|
69347
|
-
inferFromTypes(source, target);
|
|
69348
|
-
contravariant = !contravariant;
|
|
69368
|
+
inferFromContravariantTypes(source, target);
|
|
69349
69369
|
}
|
|
69350
69370
|
else {
|
|
69351
69371
|
inferFromTypes(source, target);
|
|
@@ -69509,11 +69529,8 @@ var ts;
|
|
|
69509
69529
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69510
69530
|
}
|
|
69511
69531
|
else {
|
|
69512
|
-
var savePriority = priority;
|
|
69513
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69514
69532
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69515
|
-
|
|
69516
|
-
priority = savePriority;
|
|
69533
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69517
69534
|
}
|
|
69518
69535
|
}
|
|
69519
69536
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69699,7 +69716,7 @@ var ts;
|
|
|
69699
69716
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69700
69717
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69701
69718
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69702
|
-
applyToParameterTypes(source, target,
|
|
69719
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69703
69720
|
bivariant = saveBivariant;
|
|
69704
69721
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69705
69722
|
}
|
|
@@ -76741,7 +76758,7 @@ var ts;
|
|
|
76741
76758
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76742
76759
|
var reportErrors = !candidatesOutArray;
|
|
76743
76760
|
var typeArguments;
|
|
76744
|
-
if (!isDecorator) {
|
|
76761
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76745
76762
|
typeArguments = node.typeArguments;
|
|
76746
76763
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76747
76764
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -93475,7 +93492,8 @@ var ts;
|
|
|
93475
93492
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
93476
93493
|
}
|
|
93477
93494
|
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
93478
|
-
|
|
93495
|
+
var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
|
|
93496
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
|
|
93479
93497
|
// End the lexical environment.
|
|
93480
93498
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
93481
93499
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
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.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220722",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|