typescript 4.7.0-dev.20220323 → 4.7.0-dev.20220325
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/de/diagnosticMessages.generated.json +4 -1
- package/lib/es/diagnosticMessages.generated.json +4 -1
- package/lib/fr/diagnosticMessages.generated.json +4 -1
- package/lib/pt-br/diagnosticMessages.generated.json +4 -1
- package/lib/ru/diagnosticMessages.generated.json +4 -1
- package/lib/tsc.js +432 -378
- package/lib/tsserver.js +595 -491
- package/lib/tsserverlibrary.js +595 -491
- package/lib/typescript.js +595 -491
- package/lib/typescriptServices.js +595 -491
- package/lib/typingsInstaller.js +496 -443
- package/package.json +1 -1
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.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220325";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8407,6 +8407,7 @@ var ts;
|
|
|
8407
8407
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
8408
8408
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
8409
8409
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
8410
|
+
This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
|
|
8410
8411
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8411
8412
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
8412
8413
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -44430,11 +44431,14 @@ var ts;
|
|
|
44430
44431
|
var saveExceptionTarget = currentExceptionTarget;
|
|
44431
44432
|
var saveActiveLabelList = activeLabelList;
|
|
44432
44433
|
var saveHasExplicitReturn = hasExplicitReturn;
|
|
44433
|
-
var
|
|
44434
|
-
!
|
|
44434
|
+
var isImmediatelyInvoked = (containerFlags & 16 /* IsFunctionExpression */ &&
|
|
44435
|
+
!ts.hasSyntacticModifier(node, 256 /* Async */) &&
|
|
44436
|
+
!node.asteriskToken &&
|
|
44437
|
+
!!ts.getImmediatelyInvokedFunctionExpression(node)) ||
|
|
44438
|
+
node.kind === 170 /* ClassStaticBlockDeclaration */;
|
|
44435
44439
|
// A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave
|
|
44436
44440
|
// similarly to break statements that exit to a label just past the statement body.
|
|
44437
|
-
if (!
|
|
44441
|
+
if (!isImmediatelyInvoked) {
|
|
44438
44442
|
currentFlow = initFlowNode({ flags: 2 /* Start */ });
|
|
44439
44443
|
if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) {
|
|
44440
44444
|
currentFlow.node = node;
|
|
@@ -44442,7 +44446,7 @@ var ts;
|
|
|
44442
44446
|
}
|
|
44443
44447
|
// We create a return control flow graph for IIFEs and constructors. For constructors
|
|
44444
44448
|
// we use the return control flow graph in strict property initialization checks.
|
|
44445
|
-
currentReturnTarget =
|
|
44449
|
+
currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* FunctionDeclaration */ || node.kind === 213 /* FunctionExpression */)) ? createBranchLabel() : undefined;
|
|
44446
44450
|
currentExceptionTarget = undefined;
|
|
44447
44451
|
currentBreakTarget = undefined;
|
|
44448
44452
|
currentContinueTarget = undefined;
|
|
@@ -44468,7 +44472,7 @@ var ts;
|
|
|
44468
44472
|
node.returnFlowNode = currentFlow;
|
|
44469
44473
|
}
|
|
44470
44474
|
}
|
|
44471
|
-
if (!
|
|
44475
|
+
if (!isImmediatelyInvoked) {
|
|
44472
44476
|
currentFlow = saveCurrentFlow;
|
|
44473
44477
|
}
|
|
44474
44478
|
currentBreakTarget = saveBreakTarget;
|
|
@@ -47514,7 +47518,7 @@ var ts;
|
|
|
47514
47518
|
(preserveConstEnums && moduleState === 2 /* ConstEnumOnly */);
|
|
47515
47519
|
}
|
|
47516
47520
|
ts.isInstantiatedModule = isInstantiatedModule;
|
|
47517
|
-
function createTypeChecker(host
|
|
47521
|
+
function createTypeChecker(host) {
|
|
47518
47522
|
var getPackagesMap = ts.memoize(function () {
|
|
47519
47523
|
// A package name maps to true when we detect it has .d.ts files.
|
|
47520
47524
|
// This is useful as an approximation of whether a package bundles its own types.
|
|
@@ -47531,6 +47535,10 @@ var ts;
|
|
|
47531
47535
|
});
|
|
47532
47536
|
return map;
|
|
47533
47537
|
});
|
|
47538
|
+
var deferredDiagnosticsCallbacks = [];
|
|
47539
|
+
var addLazyDiagnostic = function (arg) {
|
|
47540
|
+
deferredDiagnosticsCallbacks.push(arg);
|
|
47541
|
+
};
|
|
47534
47542
|
// Cancellation that controls whether or not we can cancel in the middle of type checking.
|
|
47535
47543
|
// In general cancelling is *not* safe for the type checker. We might be in the middle of
|
|
47536
47544
|
// computing something, and we will leave our internals in an inconsistent state. Callers
|
|
@@ -47894,8 +47902,8 @@ var ts;
|
|
|
47894
47902
|
// Do this in a finally block so we can ensure that it gets reset back to nothing after
|
|
47895
47903
|
// this call is done.
|
|
47896
47904
|
cancellationToken = ct;
|
|
47897
|
-
// Ensure file is type checked
|
|
47898
|
-
|
|
47905
|
+
// Ensure file is type checked, with _eager_ diagnostic production, so identifiers are registered as potentially unused
|
|
47906
|
+
checkSourceFileWithEagerDiagnostics(file);
|
|
47899
47907
|
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
|
|
47900
47908
|
diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
|
|
47901
47909
|
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
|
|
@@ -49231,110 +49239,114 @@ var ts;
|
|
|
49231
49239
|
}
|
|
49232
49240
|
}
|
|
49233
49241
|
if (!result) {
|
|
49234
|
-
if (nameNotFoundMessage
|
|
49235
|
-
|
|
49236
|
-
!
|
|
49237
|
-
!
|
|
49238
|
-
|
|
49239
|
-
|
|
49240
|
-
|
|
49241
|
-
|
|
49242
|
-
|
|
49243
|
-
|
|
49244
|
-
|
|
49245
|
-
|
|
49246
|
-
|
|
49247
|
-
|
|
49248
|
-
|
|
49249
|
-
|
|
49250
|
-
if (suggestion) {
|
|
49251
|
-
var suggestionName = symbolToString(suggestion);
|
|
49252
|
-
var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, /*excludeClasses*/ false);
|
|
49253
|
-
var message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
|
|
49254
|
-
: isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
|
|
49255
|
-
: ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
49256
|
-
var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
49257
|
-
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
49258
|
-
if (suggestion.valueDeclaration) {
|
|
49259
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
49242
|
+
if (nameNotFoundMessage) {
|
|
49243
|
+
addLazyDiagnostic(function () {
|
|
49244
|
+
if (!errorLocation ||
|
|
49245
|
+
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
49246
|
+
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
49247
|
+
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
|
|
49248
|
+
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
|
|
49249
|
+
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
|
|
49250
|
+
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
49251
|
+
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
49252
|
+
var suggestion = void 0;
|
|
49253
|
+
if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
49254
|
+
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
49255
|
+
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
49256
|
+
if (isGlobalScopeAugmentationDeclaration) {
|
|
49257
|
+
suggestion = undefined;
|
|
49260
49258
|
}
|
|
49261
|
-
|
|
49262
|
-
|
|
49263
|
-
|
|
49264
|
-
|
|
49265
|
-
|
|
49266
|
-
|
|
49267
|
-
|
|
49259
|
+
if (suggestion) {
|
|
49260
|
+
var suggestionName = symbolToString(suggestion);
|
|
49261
|
+
var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, /*excludeClasses*/ false);
|
|
49262
|
+
var message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
|
|
49263
|
+
: isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
|
|
49264
|
+
: ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
49265
|
+
var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
49266
|
+
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
49267
|
+
if (suggestion.valueDeclaration) {
|
|
49268
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
49269
|
+
}
|
|
49268
49270
|
}
|
|
49269
|
-
|
|
49270
|
-
|
|
49271
|
+
}
|
|
49272
|
+
if (!suggestion) {
|
|
49273
|
+
if (nameArg) {
|
|
49274
|
+
var lib = getSuggestedLibForNonExistentName(nameArg);
|
|
49275
|
+
if (lib) {
|
|
49276
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
|
|
49277
|
+
}
|
|
49278
|
+
else {
|
|
49279
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
49280
|
+
}
|
|
49271
49281
|
}
|
|
49272
49282
|
}
|
|
49283
|
+
suggestionCount++;
|
|
49273
49284
|
}
|
|
49274
|
-
|
|
49275
|
-
}
|
|
49285
|
+
});
|
|
49276
49286
|
}
|
|
49277
49287
|
return undefined;
|
|
49278
49288
|
}
|
|
49289
|
+
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields)) {
|
|
49290
|
+
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
49291
|
+
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
49292
|
+
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
49293
|
+
var propertyName = propertyWithInvalidInitializer.name;
|
|
49294
|
+
error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
|
|
49295
|
+
return undefined;
|
|
49296
|
+
}
|
|
49279
49297
|
// Perform extra checks only if error reporting was requested
|
|
49280
|
-
if (nameNotFoundMessage
|
|
49281
|
-
|
|
49282
|
-
//
|
|
49283
|
-
//
|
|
49284
|
-
//
|
|
49285
|
-
|
|
49286
|
-
|
|
49287
|
-
|
|
49288
|
-
|
|
49289
|
-
|
|
49290
|
-
|
|
49291
|
-
|
|
49292
|
-
|
|
49293
|
-
|
|
49294
|
-
|
|
49295
|
-
|
|
49296
|
-
|
|
49297
|
-
|
|
49298
|
-
|
|
49299
|
-
|
|
49300
|
-
|
|
49301
|
-
|
|
49302
|
-
|
|
49303
|
-
|
|
49304
|
-
|
|
49305
|
-
|
|
49306
|
-
|
|
49307
|
-
|
|
49308
|
-
|
|
49309
|
-
|
|
49310
|
-
|
|
49311
|
-
|
|
49312
|
-
|
|
49313
|
-
|
|
49314
|
-
|
|
49315
|
-
|
|
49316
|
-
|
|
49317
|
-
|
|
49318
|
-
|
|
49319
|
-
|
|
49320
|
-
|
|
49321
|
-
|
|
49322
|
-
|
|
49323
|
-
|
|
49324
|
-
|
|
49325
|
-
|
|
49326
|
-
|
|
49327
|
-
|
|
49328
|
-
|
|
49329
|
-
|
|
49330
|
-
if (typeOnlyDeclaration) {
|
|
49331
|
-
var message = typeOnlyDeclaration.kind === 275 /* ExportSpecifier */
|
|
49332
|
-
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
49333
|
-
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
49334
|
-
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
49335
|
-
addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
49298
|
+
if (nameNotFoundMessage) {
|
|
49299
|
+
addLazyDiagnostic(function () {
|
|
49300
|
+
// Only check for block-scoped variable if we have an error location and are looking for the
|
|
49301
|
+
// name with variable meaning
|
|
49302
|
+
// For example,
|
|
49303
|
+
// declare module foo {
|
|
49304
|
+
// interface bar {}
|
|
49305
|
+
// }
|
|
49306
|
+
// const foo/*1*/: foo/*2*/.bar;
|
|
49307
|
+
// The foo at /*1*/ and /*2*/ will share same symbol with two meanings:
|
|
49308
|
+
// block-scoped variable and namespace module. However, only when we
|
|
49309
|
+
// try to resolve name in /*1*/ which is used in variable position,
|
|
49310
|
+
// we want to check for block-scoped
|
|
49311
|
+
if (errorLocation &&
|
|
49312
|
+
(meaning & 2 /* BlockScopedVariable */ ||
|
|
49313
|
+
((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
|
|
49314
|
+
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
49315
|
+
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
49316
|
+
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
49317
|
+
}
|
|
49318
|
+
}
|
|
49319
|
+
// If we're in an external module, we can't reference value symbols created from UMD export declarations
|
|
49320
|
+
if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 4194304 /* JSDoc */)) {
|
|
49321
|
+
var merged = getMergedSymbol(result);
|
|
49322
|
+
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
|
|
49323
|
+
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
|
|
49324
|
+
}
|
|
49325
|
+
}
|
|
49326
|
+
// If we're in a parameter initializer or binding name, we can't reference the values of the parameter whose initializer we're within or parameters to the right
|
|
49327
|
+
if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
49328
|
+
var candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
49329
|
+
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
49330
|
+
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
|
|
49331
|
+
if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
49332
|
+
error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_itself, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
49333
|
+
}
|
|
49334
|
+
// And it cannot refer to any declarations which come after it
|
|
49335
|
+
else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
49336
|
+
error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
|
|
49337
|
+
}
|
|
49338
|
+
}
|
|
49339
|
+
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
49340
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
49341
|
+
if (typeOnlyDeclaration) {
|
|
49342
|
+
var message = typeOnlyDeclaration.kind === 275 /* ExportSpecifier */
|
|
49343
|
+
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
49344
|
+
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
49345
|
+
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
49346
|
+
addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
49347
|
+
}
|
|
49336
49348
|
}
|
|
49337
|
-
}
|
|
49349
|
+
});
|
|
49338
49350
|
}
|
|
49339
49351
|
return result;
|
|
49340
49352
|
}
|
|
@@ -50980,9 +50992,7 @@ var ts;
|
|
|
50980
50992
|
var result = new Type(checker, flags);
|
|
50981
50993
|
typeCount++;
|
|
50982
50994
|
result.id = typeCount;
|
|
50983
|
-
|
|
50984
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.recordType(result);
|
|
50985
|
-
}
|
|
50995
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.recordType(result);
|
|
50986
50996
|
return result;
|
|
50987
50997
|
}
|
|
50988
50998
|
function createOriginType(flags) {
|
|
@@ -64316,6 +64326,7 @@ var ts;
|
|
|
64316
64326
|
return 0 /* False */;
|
|
64317
64327
|
}
|
|
64318
64328
|
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
64329
|
+
var _a, _b;
|
|
64319
64330
|
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
64320
64331
|
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
64321
64332
|
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
@@ -64356,6 +64367,9 @@ var ts;
|
|
|
64356
64367
|
return;
|
|
64357
64368
|
}
|
|
64358
64369
|
reportRelationError(headMessage, source, target);
|
|
64370
|
+
if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
|
|
64371
|
+
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
|
|
64372
|
+
}
|
|
64359
64373
|
}
|
|
64360
64374
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
64361
64375
|
if (!ts.tracing) {
|
|
@@ -65128,7 +65142,7 @@ var ts;
|
|
|
65128
65142
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65129
65143
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65130
65144
|
var constraint = getConstraintOfType(source);
|
|
65131
|
-
if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65145
|
+
if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
|
|
65132
65146
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65133
65147
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65134
65148
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65136,12 +65150,12 @@ var ts;
|
|
|
65136
65150
|
}
|
|
65137
65151
|
}
|
|
65138
65152
|
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
|
|
65139
|
-
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65153
|
+
else if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
|
|
65140
65154
|
resetErrorInfo(saveErrorInfo);
|
|
65141
65155
|
return result;
|
|
65142
65156
|
}
|
|
65143
65157
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65144
|
-
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65158
|
+
else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState))) {
|
|
65145
65159
|
resetErrorInfo(saveErrorInfo);
|
|
65146
65160
|
return result;
|
|
65147
65161
|
}
|
|
@@ -67200,12 +67214,14 @@ var ts;
|
|
|
67200
67214
|
errorOrSuggestion(noImplicitAny, declaration, diagnostic, ts.declarationNameToString(ts.getNameOfDeclaration(declaration)), typeAsString);
|
|
67201
67215
|
}
|
|
67202
67216
|
function reportErrorsFromWidening(declaration, type, wideningKind) {
|
|
67203
|
-
|
|
67204
|
-
|
|
67205
|
-
|
|
67206
|
-
|
|
67217
|
+
addLazyDiagnostic(function () {
|
|
67218
|
+
if (noImplicitAny && ts.getObjectFlags(type) & 65536 /* ContainsWideningType */ && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration))) {
|
|
67219
|
+
// Report implicit any error within type if possible, otherwise report error on declaration
|
|
67220
|
+
if (!reportWideningErrorsInType(type)) {
|
|
67221
|
+
reportImplicitAny(declaration, type, wideningKind);
|
|
67222
|
+
}
|
|
67207
67223
|
}
|
|
67208
|
-
}
|
|
67224
|
+
});
|
|
67209
67225
|
}
|
|
67210
67226
|
function applyToParameterTypes(source, target, callback) {
|
|
67211
67227
|
var sourceCount = getParameterCount(source);
|
|
@@ -73968,6 +73984,7 @@ var ts;
|
|
|
73968
73984
|
&& !isOptionalPropertyDeclaration(valueDeclaration)
|
|
73969
73985
|
&& !(ts.isAccessExpression(node) && ts.isAccessExpression(node.expression))
|
|
73970
73986
|
&& !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)
|
|
73987
|
+
&& !(ts.isMethodDeclaration(valueDeclaration) && ts.getCombinedModifierFlags(valueDeclaration) & 32 /* Static */)
|
|
73971
73988
|
&& (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
73972
73989
|
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
73973
73990
|
}
|
|
@@ -75197,7 +75214,7 @@ var ts;
|
|
|
75197
75214
|
var isTaggedTemplate = node.kind === 210 /* TaggedTemplateExpression */;
|
|
75198
75215
|
var isDecorator = node.kind === 165 /* Decorator */;
|
|
75199
75216
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
75200
|
-
var reportErrors = !candidatesOutArray
|
|
75217
|
+
var reportErrors = !candidatesOutArray;
|
|
75201
75218
|
var typeArguments;
|
|
75202
75219
|
if (!isDecorator) {
|
|
75203
75220
|
typeArguments = node.typeArguments;
|
|
@@ -76477,11 +76494,13 @@ var ts;
|
|
|
76477
76494
|
checkSourceElement(type);
|
|
76478
76495
|
exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType));
|
|
76479
76496
|
var targetType = getTypeFromTypeNode(type);
|
|
76480
|
-
if (
|
|
76481
|
-
|
|
76482
|
-
|
|
76483
|
-
|
|
76484
|
-
|
|
76497
|
+
if (!isErrorType(targetType)) {
|
|
76498
|
+
addLazyDiagnostic(function () {
|
|
76499
|
+
var widenedType = getWidenedType(exprType);
|
|
76500
|
+
if (!isTypeComparableTo(targetType, widenedType)) {
|
|
76501
|
+
checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
|
|
76502
|
+
}
|
|
76503
|
+
});
|
|
76485
76504
|
}
|
|
76486
76505
|
return targetType;
|
|
76487
76506
|
}
|
|
@@ -77241,47 +77260,48 @@ var ts;
|
|
|
77241
77260
|
* @param returnType - return type of the function, can be undefined if return type is not explicitly specified
|
|
77242
77261
|
*/
|
|
77243
77262
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
77244
|
-
|
|
77245
|
-
|
|
77246
|
-
|
|
77247
|
-
|
|
77248
|
-
|
|
77249
|
-
|
|
77250
|
-
|
|
77251
|
-
|
|
77252
|
-
|
|
77253
|
-
|
|
77254
|
-
|
|
77255
|
-
|
|
77256
|
-
|
|
77257
|
-
|
|
77258
|
-
|
|
77259
|
-
|
|
77260
|
-
|
|
77261
|
-
|
|
77262
|
-
|
|
77263
|
-
|
|
77264
|
-
|
|
77265
|
-
|
|
77266
|
-
|
|
77267
|
-
|
|
77268
|
-
|
|
77269
|
-
|
|
77270
|
-
|
|
77271
|
-
|
|
77272
|
-
|
|
77273
|
-
|
|
77274
|
-
|
|
77275
|
-
|
|
77276
|
-
|
|
77277
|
-
|
|
77278
|
-
|
|
77279
|
-
|
|
77280
|
-
|
|
77281
|
-
|
|
77263
|
+
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
77264
|
+
return;
|
|
77265
|
+
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
77266
|
+
var functionFlags = ts.getFunctionFlags(func);
|
|
77267
|
+
var type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
77268
|
+
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
|
|
77269
|
+
if (type && maybeTypeOfKind(type, 1 /* Any */ | 16384 /* Void */)) {
|
|
77270
|
+
return;
|
|
77271
|
+
}
|
|
77272
|
+
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
|
|
77273
|
+
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
|
|
77274
|
+
if (func.kind === 168 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
77275
|
+
return;
|
|
77276
|
+
}
|
|
77277
|
+
var hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
77278
|
+
var errorNode = ts.getEffectiveReturnTypeNode(func) || func;
|
|
77279
|
+
if (type && type.flags & 131072 /* Never */) {
|
|
77280
|
+
error(errorNode, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
77281
|
+
}
|
|
77282
|
+
else if (type && !hasExplicitReturn) {
|
|
77283
|
+
// minimal check: function has syntactic return type annotation and no explicit return statements in the body
|
|
77284
|
+
// this function does not conform to the specification.
|
|
77285
|
+
error(errorNode, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
|
77286
|
+
}
|
|
77287
|
+
else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
77288
|
+
error(errorNode, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
77289
|
+
}
|
|
77290
|
+
else if (compilerOptions.noImplicitReturns) {
|
|
77291
|
+
if (!type) {
|
|
77292
|
+
// If return type annotation is omitted check if function has any explicit return statements.
|
|
77293
|
+
// If it does not have any - its inferred return type is void - don't do any checks.
|
|
77294
|
+
// Otherwise get inferred return type from function body and report error only if it is not void / anytype
|
|
77295
|
+
if (!hasExplicitReturn) {
|
|
77296
|
+
return;
|
|
77297
|
+
}
|
|
77298
|
+
var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));
|
|
77299
|
+
if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {
|
|
77300
|
+
return;
|
|
77301
|
+
}
|
|
77282
77302
|
}
|
|
77303
|
+
error(errorNode, ts.Diagnostics.Not_all_code_paths_return_a_value);
|
|
77283
77304
|
}
|
|
77284
|
-
error(errorNode, ts.Diagnostics.Not_all_code_paths_return_a_value);
|
|
77285
77305
|
}
|
|
77286
77306
|
}
|
|
77287
77307
|
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
|
|
@@ -77541,49 +77561,50 @@ var ts;
|
|
|
77541
77561
|
checkExpression(node.expression);
|
|
77542
77562
|
return undefinedWideningType;
|
|
77543
77563
|
}
|
|
77544
|
-
function
|
|
77564
|
+
function checkAwaitExpressionGrammar(node) {
|
|
77545
77565
|
// Grammar checking
|
|
77546
|
-
|
|
77547
|
-
|
|
77548
|
-
|
|
77549
|
-
|
|
77550
|
-
|
|
77551
|
-
|
|
77552
|
-
|
|
77553
|
-
|
|
77554
|
-
|
|
77555
|
-
|
|
77556
|
-
if (!
|
|
77557
|
-
if (!span)
|
|
77558
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
77559
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
77560
|
-
diagnostics.add(diagnostic);
|
|
77561
|
-
}
|
|
77562
|
-
if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
|
|
77566
|
+
var container = ts.getContainingFunctionOrClassStaticBlock(node);
|
|
77567
|
+
if (container && ts.isClassStaticBlockDeclaration(container)) {
|
|
77568
|
+
error(node, ts.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
77569
|
+
}
|
|
77570
|
+
else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
77571
|
+
if (ts.isInTopLevelContext(node)) {
|
|
77572
|
+
var sourceFile = ts.getSourceFileOfNode(node);
|
|
77573
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77574
|
+
var span = void 0;
|
|
77575
|
+
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
77576
|
+
if (!span)
|
|
77563
77577
|
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
77564
|
-
|
|
77565
|
-
|
|
77566
|
-
}
|
|
77578
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
77579
|
+
diagnostics.add(diagnostic);
|
|
77567
77580
|
}
|
|
77568
|
-
|
|
77569
|
-
|
|
77570
|
-
|
|
77571
|
-
var sourceFile = ts.getSourceFileOfNode(node);
|
|
77572
|
-
if (!hasParseDiagnostics(sourceFile)) {
|
|
77573
|
-
var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
77574
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
|
|
77575
|
-
if (container && container.kind !== 171 /* Constructor */ && (ts.getFunctionFlags(container) & 2 /* Async */) === 0) {
|
|
77576
|
-
var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
|
|
77577
|
-
ts.addRelatedInfo(diagnostic, relatedInfo);
|
|
77578
|
-
}
|
|
77581
|
+
if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
|
|
77582
|
+
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
77583
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
|
|
77579
77584
|
diagnostics.add(diagnostic);
|
|
77580
77585
|
}
|
|
77581
77586
|
}
|
|
77582
77587
|
}
|
|
77583
|
-
|
|
77584
|
-
|
|
77588
|
+
else {
|
|
77589
|
+
// use of 'await' in non-async function
|
|
77590
|
+
var sourceFile = ts.getSourceFileOfNode(node);
|
|
77591
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77592
|
+
var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
77593
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
|
|
77594
|
+
if (container && container.kind !== 171 /* Constructor */ && (ts.getFunctionFlags(container) & 2 /* Async */) === 0) {
|
|
77595
|
+
var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
|
|
77596
|
+
ts.addRelatedInfo(diagnostic, relatedInfo);
|
|
77597
|
+
}
|
|
77598
|
+
diagnostics.add(diagnostic);
|
|
77599
|
+
}
|
|
77585
77600
|
}
|
|
77586
77601
|
}
|
|
77602
|
+
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
77603
|
+
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
77604
|
+
}
|
|
77605
|
+
}
|
|
77606
|
+
function checkAwaitExpression(node) {
|
|
77607
|
+
addLazyDiagnostic(function () { return checkAwaitExpressionGrammar(node); });
|
|
77587
77608
|
var operandType = checkExpression(node.expression);
|
|
77588
77609
|
var awaitedType = checkAwaitedType(operandType, /*withAlias*/ true, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
|
|
77589
77610
|
if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3 /* AnyOrUnknown */)) {
|
|
@@ -78407,7 +78428,10 @@ var ts;
|
|
|
78407
78428
|
}
|
|
78408
78429
|
}
|
|
78409
78430
|
function checkAssignmentOperator(valueType) {
|
|
78410
|
-
if (
|
|
78431
|
+
if (ts.isAssignmentOperator(operator)) {
|
|
78432
|
+
addLazyDiagnostic(checkAssignmentOperatorWorker);
|
|
78433
|
+
}
|
|
78434
|
+
function checkAssignmentOperatorWorker() {
|
|
78411
78435
|
// TypeScript 1.0 spec (April 2014): 4.17
|
|
78412
78436
|
// An assignment of the form
|
|
78413
78437
|
// VarExpr = ValueExpr
|
|
@@ -78506,15 +78530,7 @@ var ts;
|
|
|
78506
78530
|
return [effectiveLeft, effectiveRight];
|
|
78507
78531
|
}
|
|
78508
78532
|
function checkYieldExpression(node) {
|
|
78509
|
-
|
|
78510
|
-
if (produceDiagnostics) {
|
|
78511
|
-
if (!(node.flags & 8192 /* YieldContext */)) {
|
|
78512
|
-
grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
78513
|
-
}
|
|
78514
|
-
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
78515
|
-
error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
78516
|
-
}
|
|
78517
|
-
}
|
|
78533
|
+
addLazyDiagnostic(checkYieldExpressionGrammar);
|
|
78518
78534
|
var func = ts.getContainingFunction(node);
|
|
78519
78535
|
if (!func)
|
|
78520
78536
|
return anyType;
|
|
@@ -78560,14 +78576,24 @@ var ts;
|
|
|
78560
78576
|
var type = getContextualIterationType(2 /* Next */, func);
|
|
78561
78577
|
if (!type) {
|
|
78562
78578
|
type = anyType;
|
|
78563
|
-
|
|
78564
|
-
|
|
78565
|
-
|
|
78566
|
-
|
|
78579
|
+
addLazyDiagnostic(function () {
|
|
78580
|
+
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
78581
|
+
var contextualType = getContextualType(node);
|
|
78582
|
+
if (!contextualType || isTypeAny(contextualType)) {
|
|
78583
|
+
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
78584
|
+
}
|
|
78567
78585
|
}
|
|
78568
|
-
}
|
|
78586
|
+
});
|
|
78569
78587
|
}
|
|
78570
78588
|
return type;
|
|
78589
|
+
function checkYieldExpressionGrammar() {
|
|
78590
|
+
if (!(node.flags & 8192 /* YieldContext */)) {
|
|
78591
|
+
grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
78592
|
+
}
|
|
78593
|
+
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
78594
|
+
error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
78595
|
+
}
|
|
78596
|
+
}
|
|
78571
78597
|
}
|
|
78572
78598
|
function checkConditionalExpression(node, checkMode) {
|
|
78573
78599
|
checkTruthinessExpression(node.condition);
|
|
@@ -79163,9 +79189,7 @@ var ts;
|
|
|
79163
79189
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79164
79190
|
}
|
|
79165
79191
|
}
|
|
79166
|
-
|
|
79167
|
-
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
|
|
79168
|
-
}
|
|
79192
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79169
79193
|
}
|
|
79170
79194
|
function checkParameter(node) {
|
|
79171
79195
|
// Grammar checking
|
|
@@ -79319,7 +79343,8 @@ var ts;
|
|
|
79319
79343
|
if (node.type) {
|
|
79320
79344
|
checkSourceElement(node.type);
|
|
79321
79345
|
}
|
|
79322
|
-
|
|
79346
|
+
addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
|
|
79347
|
+
function checkSignatureDeclarationDiagnostics() {
|
|
79323
79348
|
checkCollisionWithArgumentsInGeneratedCode(node);
|
|
79324
79349
|
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
|
|
79325
79350
|
if (noImplicitAny && !returnTypeNode) {
|
|
@@ -79609,9 +79634,8 @@ var ts;
|
|
|
79609
79634
|
if (ts.nodeIsMissing(node.body)) {
|
|
79610
79635
|
return;
|
|
79611
79636
|
}
|
|
79612
|
-
|
|
79613
|
-
|
|
79614
|
-
}
|
|
79637
|
+
addLazyDiagnostic(checkConstructorDeclarationDiagnostics);
|
|
79638
|
+
return;
|
|
79615
79639
|
function isInstancePropertyWithInitializerOrPrivateIdentifierProperty(n) {
|
|
79616
79640
|
if (ts.isPrivateIdentifierClassElementDeclaration(n)) {
|
|
79617
79641
|
return true;
|
|
@@ -79620,54 +79644,56 @@ var ts;
|
|
|
79620
79644
|
!ts.isStatic(n) &&
|
|
79621
79645
|
!!n.initializer;
|
|
79622
79646
|
}
|
|
79623
|
-
|
|
79624
|
-
|
|
79625
|
-
|
|
79626
|
-
|
|
79627
|
-
|
|
79628
|
-
|
|
79629
|
-
|
|
79630
|
-
|
|
79631
|
-
|
|
79632
|
-
if (
|
|
79633
|
-
|
|
79634
|
-
|
|
79635
|
-
|
|
79636
|
-
|
|
79637
|
-
|
|
79638
|
-
|
|
79639
|
-
|
|
79640
|
-
(ts.
|
|
79641
|
-
ts.some(node.
|
|
79642
|
-
|
|
79643
|
-
|
|
79644
|
-
// See GH #8277
|
|
79645
|
-
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79646
|
-
error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
79647
|
-
}
|
|
79648
|
-
// Skip past any prologue directives to check statements for referring to 'super' or 'this' before a super call
|
|
79649
|
-
else {
|
|
79650
|
-
var superCallStatement = void 0;
|
|
79651
|
-
for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
|
|
79652
|
-
var statement = _a[_i];
|
|
79653
|
-
if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
|
|
79654
|
-
superCallStatement = statement;
|
|
79655
|
-
break;
|
|
79656
|
-
}
|
|
79657
|
-
if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
79658
|
-
break;
|
|
79659
|
-
}
|
|
79660
|
-
}
|
|
79647
|
+
function checkConstructorDeclarationDiagnostics() {
|
|
79648
|
+
// TS 1.0 spec (April 2014): 8.3.2
|
|
79649
|
+
// Constructors of classes with no extends clause may not contain super calls, whereas
|
|
79650
|
+
// constructors of derived classes must contain at least one super call somewhere in their function body.
|
|
79651
|
+
var containingClassDecl = node.parent;
|
|
79652
|
+
if (ts.getClassExtendsHeritageElement(containingClassDecl)) {
|
|
79653
|
+
captureLexicalThis(node.parent, containingClassDecl);
|
|
79654
|
+
var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
|
|
79655
|
+
var superCall = findFirstSuperCall(node.body);
|
|
79656
|
+
if (superCall) {
|
|
79657
|
+
if (classExtendsNull) {
|
|
79658
|
+
error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
79659
|
+
}
|
|
79660
|
+
// A super call must be root-level in a constructor if both of the following are true:
|
|
79661
|
+
// - The containing class is a derived class.
|
|
79662
|
+
// - The constructor declares parameter properties
|
|
79663
|
+
// or the containing class declares instance member variables with initializers.
|
|
79664
|
+
var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) &&
|
|
79665
|
+
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
79666
|
+
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */); }));
|
|
79667
|
+
if (superCallShouldBeRootLevel) {
|
|
79661
79668
|
// Until we have better flow analysis, it is an error to place the super call within any kind of block or conditional
|
|
79662
79669
|
// See GH #8277
|
|
79663
|
-
if (
|
|
79664
|
-
error(
|
|
79670
|
+
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79671
|
+
error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
79672
|
+
}
|
|
79673
|
+
// Skip past any prologue directives to check statements for referring to 'super' or 'this' before a super call
|
|
79674
|
+
else {
|
|
79675
|
+
var superCallStatement = void 0;
|
|
79676
|
+
for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
|
|
79677
|
+
var statement = _a[_i];
|
|
79678
|
+
if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
|
|
79679
|
+
superCallStatement = statement;
|
|
79680
|
+
break;
|
|
79681
|
+
}
|
|
79682
|
+
if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
79683
|
+
break;
|
|
79684
|
+
}
|
|
79685
|
+
}
|
|
79686
|
+
// Until we have better flow analysis, it is an error to place the super call within any kind of block or conditional
|
|
79687
|
+
// See GH #8277
|
|
79688
|
+
if (superCallStatement === undefined) {
|
|
79689
|
+
error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
79690
|
+
}
|
|
79665
79691
|
}
|
|
79666
79692
|
}
|
|
79667
79693
|
}
|
|
79668
|
-
|
|
79669
|
-
|
|
79670
|
-
|
|
79694
|
+
else if (!classExtendsNull) {
|
|
79695
|
+
error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
79696
|
+
}
|
|
79671
79697
|
}
|
|
79672
79698
|
}
|
|
79673
79699
|
}
|
|
@@ -79685,7 +79711,10 @@ var ts;
|
|
|
79685
79711
|
return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
|
|
79686
79712
|
}
|
|
79687
79713
|
function checkAccessorDeclaration(node) {
|
|
79688
|
-
|
|
79714
|
+
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
79715
|
+
checkSourceElement(node.body);
|
|
79716
|
+
setNodeLinksForPrivateIdentifierScope(node);
|
|
79717
|
+
function checkAccessorDeclarationDiagnostics() {
|
|
79689
79718
|
// Grammar checking accessors
|
|
79690
79719
|
if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node))
|
|
79691
79720
|
checkGrammarComputedPropertyName(node.name);
|
|
@@ -79735,8 +79764,6 @@ var ts;
|
|
|
79735
79764
|
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
|
|
79736
79765
|
}
|
|
79737
79766
|
}
|
|
79738
|
-
checkSourceElement(node.body);
|
|
79739
|
-
setNodeLinksForPrivateIdentifierScope(node);
|
|
79740
79767
|
}
|
|
79741
79768
|
function checkMissingDeclaration(node) {
|
|
79742
79769
|
checkDecorators(node);
|
|
@@ -79779,11 +79806,13 @@ var ts;
|
|
|
79779
79806
|
ts.forEach(node.typeArguments, checkSourceElement);
|
|
79780
79807
|
var type = getTypeFromTypeReference(node);
|
|
79781
79808
|
if (!isErrorType(type)) {
|
|
79782
|
-
if (node.typeArguments
|
|
79783
|
-
|
|
79784
|
-
|
|
79785
|
-
|
|
79786
|
-
|
|
79809
|
+
if (node.typeArguments) {
|
|
79810
|
+
addLazyDiagnostic(function () {
|
|
79811
|
+
var typeParameters = getTypeParametersForTypeReference(node);
|
|
79812
|
+
if (typeParameters) {
|
|
79813
|
+
checkTypeArgumentConstraints(node, typeParameters);
|
|
79814
|
+
}
|
|
79815
|
+
});
|
|
79787
79816
|
}
|
|
79788
79817
|
var symbol = getNodeLinks(node).resolvedSymbol;
|
|
79789
79818
|
if (symbol) {
|
|
@@ -79811,7 +79840,8 @@ var ts;
|
|
|
79811
79840
|
}
|
|
79812
79841
|
function checkTypeLiteral(node) {
|
|
79813
79842
|
ts.forEach(node.members, checkSourceElement);
|
|
79814
|
-
|
|
79843
|
+
addLazyDiagnostic(checkTypeLiteralDiagnostics);
|
|
79844
|
+
function checkTypeLiteralDiagnostics() {
|
|
79815
79845
|
var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
|
|
79816
79846
|
checkIndexConstraints(type, type.symbol);
|
|
79817
79847
|
checkTypeForDuplicateIndexSignatures(node);
|
|
@@ -80002,9 +80032,9 @@ var ts;
|
|
|
80002
80032
|
return flags & flagsToCheck;
|
|
80003
80033
|
}
|
|
80004
80034
|
function checkFunctionOrConstructorSymbol(symbol) {
|
|
80005
|
-
|
|
80006
|
-
|
|
80007
|
-
|
|
80035
|
+
addLazyDiagnostic(function () { return checkFunctionOrConstructorSymbolWorker(symbol); });
|
|
80036
|
+
}
|
|
80037
|
+
function checkFunctionOrConstructorSymbolWorker(symbol) {
|
|
80008
80038
|
function getCanonicalOverload(overloads, implementation) {
|
|
80009
80039
|
// Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration
|
|
80010
80040
|
// Error on all deviations from this canonical set of flags
|
|
@@ -80225,9 +80255,9 @@ var ts;
|
|
|
80225
80255
|
}
|
|
80226
80256
|
}
|
|
80227
80257
|
function checkExportsOnMergedDeclarations(node) {
|
|
80228
|
-
|
|
80229
|
-
|
|
80230
|
-
|
|
80258
|
+
addLazyDiagnostic(function () { return checkExportsOnMergedDeclarationsWorker(node); });
|
|
80259
|
+
}
|
|
80260
|
+
function checkExportsOnMergedDeclarationsWorker(node) {
|
|
80231
80261
|
// if localSymbol is defined on node then node itself is exported - check is required
|
|
80232
80262
|
var symbol = node.localSymbol;
|
|
80233
80263
|
if (!symbol) {
|
|
@@ -80871,7 +80901,8 @@ var ts;
|
|
|
80871
80901
|
ts.forEach(node.decorators, checkDecorator);
|
|
80872
80902
|
}
|
|
80873
80903
|
function checkFunctionDeclaration(node) {
|
|
80874
|
-
|
|
80904
|
+
addLazyDiagnostic(checkFunctionDeclarationDiagnostics);
|
|
80905
|
+
function checkFunctionDeclarationDiagnostics() {
|
|
80875
80906
|
checkFunctionOrMethodDeclaration(node);
|
|
80876
80907
|
checkGrammarForGenerator(node);
|
|
80877
80908
|
checkCollisionsForDeclarationName(node, node.name);
|
|
@@ -80905,10 +80936,13 @@ var ts;
|
|
|
80905
80936
|
checkSourceElement(node.typeExpression);
|
|
80906
80937
|
}
|
|
80907
80938
|
function checkJSDocFunctionType(node) {
|
|
80908
|
-
|
|
80909
|
-
reportImplicitAny(node, anyType);
|
|
80910
|
-
}
|
|
80939
|
+
addLazyDiagnostic(checkJSDocFunctionTypeImplicitAny);
|
|
80911
80940
|
checkSignatureDeclaration(node);
|
|
80941
|
+
function checkJSDocFunctionTypeImplicitAny() {
|
|
80942
|
+
if (!node.type && !ts.isJSDocConstructSignature(node)) {
|
|
80943
|
+
reportImplicitAny(node, anyType);
|
|
80944
|
+
}
|
|
80945
|
+
}
|
|
80912
80946
|
}
|
|
80913
80947
|
function checkJSDocImplementsTag(node) {
|
|
80914
80948
|
var classLike = ts.getEffectiveJSDocHost(node);
|
|
@@ -80989,19 +81023,7 @@ var ts;
|
|
|
80989
81023
|
var body = node.kind === 168 /* MethodSignature */ ? undefined : node.body;
|
|
80990
81024
|
checkSourceElement(body);
|
|
80991
81025
|
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node));
|
|
80992
|
-
|
|
80993
|
-
// Report an implicit any error if there is no body, no explicit return type, and node is not a private method
|
|
80994
|
-
// in an ambient context
|
|
80995
|
-
if (ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
|
|
80996
|
-
reportImplicitAny(node, anyType);
|
|
80997
|
-
}
|
|
80998
|
-
if (functionFlags & 1 /* Generator */ && ts.nodeIsPresent(body)) {
|
|
80999
|
-
// A generator with a body and no type annotation can still cause errors. It can error if the
|
|
81000
|
-
// yielded values have no common supertype, or it can give an implicit any error if it has no
|
|
81001
|
-
// yielded values. The only way to trigger these errors is to try checking its return type.
|
|
81002
|
-
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
|
|
81003
|
-
}
|
|
81004
|
-
}
|
|
81026
|
+
addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics);
|
|
81005
81027
|
// A js function declaration can have a @type tag instead of a return type node, but that type must have a call signature
|
|
81006
81028
|
if (ts.isInJSFile(node)) {
|
|
81007
81029
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
@@ -81009,10 +81031,26 @@ var ts;
|
|
|
81009
81031
|
error(typeTag.typeExpression.type, ts.Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
81010
81032
|
}
|
|
81011
81033
|
}
|
|
81034
|
+
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
81035
|
+
if (!ts.getEffectiveReturnTypeNode(node)) {
|
|
81036
|
+
// Report an implicit any error if there is no body, no explicit return type, and node is not a private method
|
|
81037
|
+
// in an ambient context
|
|
81038
|
+
if (ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
|
|
81039
|
+
reportImplicitAny(node, anyType);
|
|
81040
|
+
}
|
|
81041
|
+
if (functionFlags & 1 /* Generator */ && ts.nodeIsPresent(body)) {
|
|
81042
|
+
// A generator with a body and no type annotation can still cause errors. It can error if the
|
|
81043
|
+
// yielded values have no common supertype, or it can give an implicit any error if it has no
|
|
81044
|
+
// yielded values. The only way to trigger these errors is to try checking its return type.
|
|
81045
|
+
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
|
|
81046
|
+
}
|
|
81047
|
+
}
|
|
81048
|
+
}
|
|
81012
81049
|
}
|
|
81013
81050
|
function registerForUnusedIdentifiersCheck(node) {
|
|
81014
|
-
|
|
81015
|
-
|
|
81051
|
+
addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
|
|
81052
|
+
function registerForUnusedIdentifiersCheckDiagnostics() {
|
|
81053
|
+
// May be in a call such as getTypeOfNode that happened to call this. But potentiallyUnusedIdentifiers is only defined in the scope of `checkSourceFile`.
|
|
81016
81054
|
var sourceFile = ts.getSourceFileOfNode(node);
|
|
81017
81055
|
var potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
|
|
81018
81056
|
if (!potentiallyUnusedIdentifiers) {
|
|
@@ -82786,26 +82824,31 @@ var ts;
|
|
|
82786
82824
|
hasDuplicateDefaultClause = true;
|
|
82787
82825
|
}
|
|
82788
82826
|
}
|
|
82789
|
-
if (
|
|
82790
|
-
|
|
82791
|
-
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
|
|
82792
|
-
// to or from the type of the 'switch' expression.
|
|
82793
|
-
var caseType = checkExpression(clause.expression);
|
|
82794
|
-
var caseIsLiteral = isLiteralType(caseType);
|
|
82795
|
-
var comparedExpressionType = expressionType;
|
|
82796
|
-
if (!caseIsLiteral || !expressionIsLiteral) {
|
|
82797
|
-
caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
|
|
82798
|
-
comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
|
|
82799
|
-
}
|
|
82800
|
-
if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
|
|
82801
|
-
// expressionType is not comparable to caseType, try the reversed check and report errors if it fails
|
|
82802
|
-
checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, /*headMessage*/ undefined);
|
|
82803
|
-
}
|
|
82827
|
+
if (clause.kind === 289 /* CaseClause */) {
|
|
82828
|
+
addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause));
|
|
82804
82829
|
}
|
|
82805
82830
|
ts.forEach(clause.statements, checkSourceElement);
|
|
82806
82831
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
82807
82832
|
error(clause, ts.Diagnostics.Fallthrough_case_in_switch);
|
|
82808
82833
|
}
|
|
82834
|
+
function createLazyCaseClauseDiagnostics(clause) {
|
|
82835
|
+
return function () {
|
|
82836
|
+
// TypeScript 1.0 spec (April 2014): 5.9
|
|
82837
|
+
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
|
|
82838
|
+
// to or from the type of the 'switch' expression.
|
|
82839
|
+
var caseType = checkExpression(clause.expression);
|
|
82840
|
+
var caseIsLiteral = isLiteralType(caseType);
|
|
82841
|
+
var comparedExpressionType = expressionType;
|
|
82842
|
+
if (!caseIsLiteral || !expressionIsLiteral) {
|
|
82843
|
+
caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
|
|
82844
|
+
comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
|
|
82845
|
+
}
|
|
82846
|
+
if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
|
|
82847
|
+
// expressionType is not comparable to caseType, try the reversed check and report errors if it fails
|
|
82848
|
+
checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, /*headMessage*/ undefined);
|
|
82849
|
+
}
|
|
82850
|
+
};
|
|
82851
|
+
}
|
|
82809
82852
|
});
|
|
82810
82853
|
if (node.caseBlock.locals) {
|
|
82811
82854
|
registerForUnusedIdentifiersCheck(node.caseBlock);
|
|
@@ -83026,26 +83069,29 @@ var ts;
|
|
|
83026
83069
|
* Check each type parameter and check that type parameters have no duplicate type parameter declarations
|
|
83027
83070
|
*/
|
|
83028
83071
|
function checkTypeParameters(typeParameterDeclarations) {
|
|
83072
|
+
var seenDefault = false;
|
|
83029
83073
|
if (typeParameterDeclarations) {
|
|
83030
|
-
var seenDefault = false;
|
|
83031
83074
|
for (var i = 0; i < typeParameterDeclarations.length; i++) {
|
|
83032
83075
|
var node = typeParameterDeclarations[i];
|
|
83033
83076
|
checkTypeParameter(node);
|
|
83034
|
-
|
|
83035
|
-
|
|
83036
|
-
|
|
83037
|
-
|
|
83038
|
-
|
|
83039
|
-
|
|
83040
|
-
|
|
83041
|
-
|
|
83042
|
-
|
|
83043
|
-
|
|
83044
|
-
|
|
83045
|
-
|
|
83077
|
+
addLazyDiagnostic(createCheckTypeParameterDiagnostic(node, i));
|
|
83078
|
+
}
|
|
83079
|
+
}
|
|
83080
|
+
function createCheckTypeParameterDiagnostic(node, i) {
|
|
83081
|
+
return function () {
|
|
83082
|
+
if (node.default) {
|
|
83083
|
+
seenDefault = true;
|
|
83084
|
+
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
83085
|
+
}
|
|
83086
|
+
else if (seenDefault) {
|
|
83087
|
+
error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
83088
|
+
}
|
|
83089
|
+
for (var j = 0; j < i; j++) {
|
|
83090
|
+
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
83091
|
+
error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));
|
|
83046
83092
|
}
|
|
83047
83093
|
}
|
|
83048
|
-
}
|
|
83094
|
+
};
|
|
83049
83095
|
}
|
|
83050
83096
|
}
|
|
83051
83097
|
/** Check that type parameter defaults only reference previously declared type parameters */
|
|
@@ -83177,85 +83223,90 @@ var ts;
|
|
|
83177
83223
|
if (extendsNode && extendsNode !== baseTypeNode) {
|
|
83178
83224
|
checkExpression(extendsNode.expression);
|
|
83179
83225
|
}
|
|
83180
|
-
var
|
|
83181
|
-
if (
|
|
83182
|
-
|
|
83183
|
-
|
|
83184
|
-
|
|
83185
|
-
|
|
83186
|
-
|
|
83187
|
-
|
|
83188
|
-
ts.
|
|
83189
|
-
|
|
83190
|
-
var
|
|
83191
|
-
|
|
83192
|
-
|
|
83226
|
+
var baseTypes_2 = getBaseTypes(type);
|
|
83227
|
+
if (baseTypes_2.length) {
|
|
83228
|
+
addLazyDiagnostic(function () {
|
|
83229
|
+
var baseType = baseTypes_2[0];
|
|
83230
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(type);
|
|
83231
|
+
var staticBaseType = getApparentType(baseConstructorType);
|
|
83232
|
+
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
|
|
83233
|
+
checkSourceElement(baseTypeNode.expression);
|
|
83234
|
+
if (ts.some(baseTypeNode.typeArguments)) {
|
|
83235
|
+
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
|
|
83236
|
+
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
|
|
83237
|
+
var constructor = _a[_i];
|
|
83238
|
+
if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) {
|
|
83239
|
+
break;
|
|
83240
|
+
}
|
|
83193
83241
|
}
|
|
83194
83242
|
}
|
|
83195
|
-
|
|
83196
|
-
|
|
83197
|
-
|
|
83198
|
-
issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);
|
|
83199
|
-
}
|
|
83200
|
-
else {
|
|
83201
|
-
// Report static side error only when instance type is assignable
|
|
83202
|
-
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
|
83203
|
-
}
|
|
83204
|
-
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
83205
|
-
if (!isMixinConstructorType(staticType)) {
|
|
83206
|
-
error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
83243
|
+
var baseWithThis = getTypeWithThisArgument(baseType, type.thisType);
|
|
83244
|
+
if (!checkTypeAssignableTo(typeWithThis, baseWithThis, /*errorNode*/ undefined)) {
|
|
83245
|
+
issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);
|
|
83207
83246
|
}
|
|
83208
83247
|
else {
|
|
83209
|
-
|
|
83210
|
-
|
|
83211
|
-
|
|
83248
|
+
// Report static side error only when instance type is assignable
|
|
83249
|
+
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
|
83250
|
+
}
|
|
83251
|
+
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
83252
|
+
if (!isMixinConstructorType(staticType)) {
|
|
83253
|
+
error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
83254
|
+
}
|
|
83255
|
+
else {
|
|
83256
|
+
var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
83257
|
+
if (constructSignatures.some(function (signature) { return signature.flags & 4 /* Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* Abstract */)) {
|
|
83258
|
+
error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
83259
|
+
}
|
|
83212
83260
|
}
|
|
83213
83261
|
}
|
|
83214
|
-
|
|
83215
|
-
|
|
83216
|
-
|
|
83217
|
-
|
|
83218
|
-
|
|
83219
|
-
|
|
83220
|
-
|
|
83262
|
+
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
83263
|
+
// When the static base type is a "class-like" constructor function (but not actually a class), we verify
|
|
83264
|
+
// that all instantiated base constructor signatures return the same type.
|
|
83265
|
+
var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
83266
|
+
if (ts.forEach(constructors, function (sig) { return !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType); })) {
|
|
83267
|
+
error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
83268
|
+
}
|
|
83221
83269
|
}
|
|
83222
|
-
|
|
83223
|
-
|
|
83270
|
+
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
83271
|
+
});
|
|
83224
83272
|
}
|
|
83225
83273
|
}
|
|
83226
83274
|
checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
|
|
83227
83275
|
var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
|
|
83228
83276
|
if (implementedTypeNodes) {
|
|
83229
|
-
for (var
|
|
83230
|
-
var typeRefNode = implementedTypeNodes_1[
|
|
83277
|
+
for (var _i = 0, implementedTypeNodes_1 = implementedTypeNodes; _i < implementedTypeNodes_1.length; _i++) {
|
|
83278
|
+
var typeRefNode = implementedTypeNodes_1[_i];
|
|
83231
83279
|
if (!ts.isEntityNameExpression(typeRefNode.expression) || ts.isOptionalChain(typeRefNode.expression)) {
|
|
83232
83280
|
error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
83233
83281
|
}
|
|
83234
83282
|
checkTypeReferenceNode(typeRefNode);
|
|
83235
|
-
|
|
83236
|
-
var t = getReducedType(getTypeFromTypeNode(typeRefNode));
|
|
83237
|
-
if (!isErrorType(t)) {
|
|
83238
|
-
if (isValidBaseType(t)) {
|
|
83239
|
-
var genericDiag = t.symbol && t.symbol.flags & 32 /* Class */ ?
|
|
83240
|
-
ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
|
|
83241
|
-
ts.Diagnostics.Class_0_incorrectly_implements_interface_1;
|
|
83242
|
-
var baseWithThis = getTypeWithThisArgument(t, type.thisType);
|
|
83243
|
-
if (!checkTypeAssignableTo(typeWithThis, baseWithThis, /*errorNode*/ undefined)) {
|
|
83244
|
-
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
83245
|
-
}
|
|
83246
|
-
}
|
|
83247
|
-
else {
|
|
83248
|
-
error(typeRefNode, ts.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
83249
|
-
}
|
|
83250
|
-
}
|
|
83251
|
-
}
|
|
83283
|
+
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
83252
83284
|
}
|
|
83253
83285
|
}
|
|
83254
|
-
|
|
83286
|
+
addLazyDiagnostic(function () {
|
|
83255
83287
|
checkIndexConstraints(type, symbol);
|
|
83256
83288
|
checkIndexConstraints(staticType, symbol, /*isStaticIndex*/ true);
|
|
83257
83289
|
checkTypeForDuplicateIndexSignatures(node);
|
|
83258
83290
|
checkPropertyInitialization(node);
|
|
83291
|
+
});
|
|
83292
|
+
function createImplementsDiagnostics(typeRefNode) {
|
|
83293
|
+
return function () {
|
|
83294
|
+
var t = getReducedType(getTypeFromTypeNode(typeRefNode));
|
|
83295
|
+
if (!isErrorType(t)) {
|
|
83296
|
+
if (isValidBaseType(t)) {
|
|
83297
|
+
var genericDiag = t.symbol && t.symbol.flags & 32 /* Class */ ?
|
|
83298
|
+
ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
|
|
83299
|
+
ts.Diagnostics.Class_0_incorrectly_implements_interface_1;
|
|
83300
|
+
var baseWithThis = getTypeWithThisArgument(t, type.thisType);
|
|
83301
|
+
if (!checkTypeAssignableTo(typeWithThis, baseWithThis, /*errorNode*/ undefined)) {
|
|
83302
|
+
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
83303
|
+
}
|
|
83304
|
+
}
|
|
83305
|
+
else {
|
|
83306
|
+
error(typeRefNode, ts.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
83307
|
+
}
|
|
83308
|
+
}
|
|
83309
|
+
};
|
|
83259
83310
|
}
|
|
83260
83311
|
}
|
|
83261
83312
|
function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
|
|
@@ -83579,8 +83630,8 @@ var ts;
|
|
|
83579
83630
|
ts.forEach(properties, function (p) {
|
|
83580
83631
|
seen.set(p.escapedName, p);
|
|
83581
83632
|
});
|
|
83582
|
-
for (var _i = 0,
|
|
83583
|
-
var base =
|
|
83633
|
+
for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
|
|
83634
|
+
var base = baseTypes_3[_i];
|
|
83584
83635
|
var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
|
|
83585
83636
|
for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
|
|
83586
83637
|
var prop = properties_4[_a];
|
|
@@ -83602,8 +83653,8 @@ var ts;
|
|
|
83602
83653
|
seen.set(p.escapedName, { prop: p, containingType: type });
|
|
83603
83654
|
});
|
|
83604
83655
|
var ok = true;
|
|
83605
|
-
for (var _i = 0,
|
|
83606
|
-
var base =
|
|
83656
|
+
for (var _i = 0, baseTypes_4 = baseTypes; _i < baseTypes_4.length; _i++) {
|
|
83657
|
+
var base = baseTypes_4[_i];
|
|
83607
83658
|
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
|
|
83608
83659
|
for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
|
|
83609
83660
|
var prop = properties_6[_a];
|
|
@@ -83687,7 +83738,7 @@ var ts;
|
|
|
83687
83738
|
if (!checkGrammarDecoratorsAndModifiers(node))
|
|
83688
83739
|
checkGrammarInterfaceDeclaration(node);
|
|
83689
83740
|
checkTypeParameters(node.typeParameters);
|
|
83690
|
-
|
|
83741
|
+
addLazyDiagnostic(function () {
|
|
83691
83742
|
checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);
|
|
83692
83743
|
checkExportsOnMergedDeclarations(node);
|
|
83693
83744
|
var symbol = getSymbolOfNode(node);
|
|
@@ -83707,7 +83758,7 @@ var ts;
|
|
|
83707
83758
|
}
|
|
83708
83759
|
}
|
|
83709
83760
|
checkObjectTypeForDuplicateDeclarations(node);
|
|
83710
|
-
}
|
|
83761
|
+
});
|
|
83711
83762
|
ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
|
|
83712
83763
|
if (!ts.isEntityNameExpression(heritageElement.expression) || ts.isOptionalChain(heritageElement.expression)) {
|
|
83713
83764
|
error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
@@ -83715,10 +83766,10 @@ var ts;
|
|
|
83715
83766
|
checkTypeReferenceNode(heritageElement);
|
|
83716
83767
|
});
|
|
83717
83768
|
ts.forEach(node.members, checkSourceElement);
|
|
83718
|
-
|
|
83769
|
+
addLazyDiagnostic(function () {
|
|
83719
83770
|
checkTypeForDuplicateIndexSignatures(node);
|
|
83720
83771
|
registerForUnusedIdentifiersCheck(node);
|
|
83721
|
-
}
|
|
83772
|
+
});
|
|
83722
83773
|
}
|
|
83723
83774
|
function checkTypeAliasDeclaration(node) {
|
|
83724
83775
|
// Grammar checking
|
|
@@ -83907,9 +83958,9 @@ var ts;
|
|
|
83907
83958
|
ts.isStringLiteralLike(node.argumentExpression);
|
|
83908
83959
|
}
|
|
83909
83960
|
function checkEnumDeclaration(node) {
|
|
83910
|
-
|
|
83911
|
-
|
|
83912
|
-
|
|
83961
|
+
addLazyDiagnostic(function () { return checkEnumDeclarationWorker(node); });
|
|
83962
|
+
}
|
|
83963
|
+
function checkEnumDeclarationWorker(node) {
|
|
83913
83964
|
// Grammar checking
|
|
83914
83965
|
checkGrammarDecoratorsAndModifiers(node);
|
|
83915
83966
|
checkCollisionsForDeclarationName(node, node.name);
|
|
@@ -83989,7 +84040,14 @@ var ts;
|
|
|
83989
84040
|
}
|
|
83990
84041
|
}
|
|
83991
84042
|
function checkModuleDeclaration(node) {
|
|
83992
|
-
if (
|
|
84043
|
+
if (node.body) {
|
|
84044
|
+
checkSourceElement(node.body);
|
|
84045
|
+
if (!ts.isGlobalScopeAugmentation(node)) {
|
|
84046
|
+
registerForUnusedIdentifiersCheck(node);
|
|
84047
|
+
}
|
|
84048
|
+
}
|
|
84049
|
+
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
84050
|
+
function checkModuleDeclarationDiagnostics() {
|
|
83993
84051
|
// Grammar checking
|
|
83994
84052
|
var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
|
|
83995
84053
|
var inAmbientContext = node.flags & 8388608 /* Ambient */;
|
|
@@ -84072,12 +84130,6 @@ var ts;
|
|
|
84072
84130
|
}
|
|
84073
84131
|
}
|
|
84074
84132
|
}
|
|
84075
|
-
if (node.body) {
|
|
84076
|
-
checkSourceElement(node.body);
|
|
84077
|
-
if (!ts.isGlobalScopeAugmentation(node)) {
|
|
84078
|
-
registerForUnusedIdentifiersCheck(node);
|
|
84079
|
-
}
|
|
84080
|
-
}
|
|
84081
84133
|
}
|
|
84082
84134
|
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
|
|
84083
84135
|
var _a;
|
|
@@ -85014,13 +85066,16 @@ var ts;
|
|
|
85014
85066
|
if (ts.isExternalOrCommonJsModule(node)) {
|
|
85015
85067
|
registerForUnusedIdentifiersCheck(node);
|
|
85016
85068
|
}
|
|
85017
|
-
|
|
85018
|
-
|
|
85019
|
-
|
|
85020
|
-
|
|
85021
|
-
|
|
85022
|
-
|
|
85023
|
-
|
|
85069
|
+
addLazyDiagnostic(function () {
|
|
85070
|
+
// This relies on the results of other lazy diagnostics, so must be computed after them
|
|
85071
|
+
if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
|
|
85072
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
|
|
85073
|
+
if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608 /* Ambient */))) {
|
|
85074
|
+
diagnostics.add(diag);
|
|
85075
|
+
}
|
|
85076
|
+
});
|
|
85077
|
+
}
|
|
85078
|
+
});
|
|
85024
85079
|
if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ &&
|
|
85025
85080
|
!node.isDeclarationFile &&
|
|
85026
85081
|
ts.isExternalModule(node)) {
|
|
@@ -85060,15 +85115,35 @@ var ts;
|
|
|
85060
85115
|
cancellationToken = undefined;
|
|
85061
85116
|
}
|
|
85062
85117
|
}
|
|
85118
|
+
function ensurePendingDiagnosticWorkComplete() {
|
|
85119
|
+
// Invoke any existing lazy diagnostics to add them, clear the backlog of diagnostics
|
|
85120
|
+
for (var _i = 0, deferredDiagnosticsCallbacks_1 = deferredDiagnosticsCallbacks; _i < deferredDiagnosticsCallbacks_1.length; _i++) {
|
|
85121
|
+
var cb = deferredDiagnosticsCallbacks_1[_i];
|
|
85122
|
+
cb();
|
|
85123
|
+
}
|
|
85124
|
+
deferredDiagnosticsCallbacks = [];
|
|
85125
|
+
}
|
|
85126
|
+
function checkSourceFileWithEagerDiagnostics(sourceFile) {
|
|
85127
|
+
ensurePendingDiagnosticWorkComplete();
|
|
85128
|
+
// then setup diagnostics for immediate invocation (as we are about to collect them, and
|
|
85129
|
+
// this avoids the overhead of longer-lived callbacks we don't need to allocate)
|
|
85130
|
+
// This also serves to make the shift to possibly lazy diagnostics transparent to serial command-line scenarios
|
|
85131
|
+
// (as in those cases, all the diagnostics will still be computed as the appropriate place in the tree,
|
|
85132
|
+
// thus much more likely retaining the same union ordering as before we had lazy diagnostics)
|
|
85133
|
+
var oldAddLazyDiagnostics = addLazyDiagnostic;
|
|
85134
|
+
addLazyDiagnostic = function (cb) { return cb(); };
|
|
85135
|
+
checkSourceFile(sourceFile);
|
|
85136
|
+
addLazyDiagnostic = oldAddLazyDiagnostics;
|
|
85137
|
+
}
|
|
85063
85138
|
function getDiagnosticsWorker(sourceFile) {
|
|
85064
|
-
throwIfNonDiagnosticsProducing();
|
|
85065
85139
|
if (sourceFile) {
|
|
85140
|
+
ensurePendingDiagnosticWorkComplete();
|
|
85066
85141
|
// Some global diagnostics are deferred until they are needed and
|
|
85067
85142
|
// may not be reported in the first call to getGlobalDiagnostics.
|
|
85068
85143
|
// We should catch these changes and report them.
|
|
85069
85144
|
var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
85070
85145
|
var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
|
|
85071
|
-
|
|
85146
|
+
checkSourceFileWithEagerDiagnostics(sourceFile);
|
|
85072
85147
|
var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
|
85073
85148
|
var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
85074
85149
|
if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
|
|
@@ -85086,18 +85161,13 @@ var ts;
|
|
|
85086
85161
|
}
|
|
85087
85162
|
// Global diagnostics are always added when a file is not provided to
|
|
85088
85163
|
// getDiagnostics
|
|
85089
|
-
ts.forEach(host.getSourceFiles(),
|
|
85164
|
+
ts.forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
|
|
85090
85165
|
return diagnostics.getDiagnostics();
|
|
85091
85166
|
}
|
|
85092
85167
|
function getGlobalDiagnostics() {
|
|
85093
|
-
|
|
85168
|
+
ensurePendingDiagnosticWorkComplete();
|
|
85094
85169
|
return diagnostics.getGlobalDiagnostics();
|
|
85095
85170
|
}
|
|
85096
|
-
function throwIfNonDiagnosticsProducing() {
|
|
85097
|
-
if (!produceDiagnostics) {
|
|
85098
|
-
throw new Error("Trying to get diagnostics from a type checker that does not produce them.");
|
|
85099
|
-
}
|
|
85100
|
-
}
|
|
85101
85171
|
// Language service support
|
|
85102
85172
|
function getSymbolsInScope(location, meaning) {
|
|
85103
85173
|
if (location.flags & 16777216 /* InWithStatement */) {
|
|
@@ -115571,8 +115641,7 @@ var ts;
|
|
|
115571
115641
|
var files;
|
|
115572
115642
|
var symlinks;
|
|
115573
115643
|
var commonSourceDirectory;
|
|
115574
|
-
var
|
|
115575
|
-
var noDiagnosticsTypeChecker;
|
|
115644
|
+
var typeChecker;
|
|
115576
115645
|
var classifiableNames;
|
|
115577
115646
|
var ambientModuleNameToUnmodifiedFileName = new ts.Map();
|
|
115578
115647
|
var fileReasons = ts.createMultiMap();
|
|
@@ -115818,21 +115887,19 @@ var ts;
|
|
|
115818
115887
|
getProgramDiagnostics: getProgramDiagnostics,
|
|
115819
115888
|
getTypeChecker: getTypeChecker,
|
|
115820
115889
|
getClassifiableNames: getClassifiableNames,
|
|
115821
|
-
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
|
|
115822
115890
|
getCommonSourceDirectory: getCommonSourceDirectory,
|
|
115823
115891
|
emit: emit,
|
|
115824
115892
|
getCurrentDirectory: function () { return currentDirectory; },
|
|
115825
|
-
getNodeCount: function () { return
|
|
115826
|
-
getIdentifierCount: function () { return
|
|
115827
|
-
getSymbolCount: function () { return
|
|
115828
|
-
getTypeCount: function () { return
|
|
115829
|
-
getInstantiationCount: function () { return
|
|
115830
|
-
getRelationCacheSizes: function () { return
|
|
115893
|
+
getNodeCount: function () { return getTypeChecker().getNodeCount(); },
|
|
115894
|
+
getIdentifierCount: function () { return getTypeChecker().getIdentifierCount(); },
|
|
115895
|
+
getSymbolCount: function () { return getTypeChecker().getSymbolCount(); },
|
|
115896
|
+
getTypeCount: function () { return getTypeChecker().getTypeCount(); },
|
|
115897
|
+
getInstantiationCount: function () { return getTypeChecker().getInstantiationCount(); },
|
|
115898
|
+
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
115831
115899
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
115832
115900
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
115833
115901
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
115834
115902
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
115835
|
-
dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker,
|
|
115836
115903
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
115837
115904
|
getLibFileFromReference: getLibFileFromReference,
|
|
115838
115905
|
sourceFileToPackageName: sourceFileToPackageName,
|
|
@@ -116421,14 +116488,8 @@ var ts;
|
|
|
116421
116488
|
return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
|
|
116422
116489
|
}
|
|
116423
116490
|
}
|
|
116424
|
-
function getDiagnosticsProducingTypeChecker() {
|
|
116425
|
-
return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true));
|
|
116426
|
-
}
|
|
116427
|
-
function dropDiagnosticsProducingTypeChecker() {
|
|
116428
|
-
diagnosticsProducingTypeChecker = undefined;
|
|
116429
|
-
}
|
|
116430
116491
|
function getTypeChecker() {
|
|
116431
|
-
return
|
|
116492
|
+
return typeChecker || (typeChecker = ts.createTypeChecker(program));
|
|
116432
116493
|
}
|
|
116433
116494
|
function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit) {
|
|
116434
116495
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emit", { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, /*separateBeginAndEnd*/ true);
|
|
@@ -116453,7 +116514,7 @@ var ts;
|
|
|
116453
116514
|
// This is because in the -out scenario all files need to be emitted, and therefore all
|
|
116454
116515
|
// files need to be type checked. And the way to specify that all files need to be type
|
|
116455
116516
|
// checked is to not pass the file to getEmitResolver.
|
|
116456
|
-
var emitResolver =
|
|
116517
|
+
var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken);
|
|
116457
116518
|
ts.performance.mark("beforeEmit");
|
|
116458
116519
|
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles,
|
|
116459
116520
|
/*onlyBuildInfo*/ false, forceDtsEmit);
|
|
@@ -116533,15 +116594,7 @@ var ts;
|
|
|
116533
116594
|
if (e instanceof ts.OperationCanceledException) {
|
|
116534
116595
|
// We were canceled while performing the operation. Because our type checker
|
|
116535
116596
|
// might be a bad state, we need to throw it away.
|
|
116536
|
-
|
|
116537
|
-
// Note: we are overly aggressive here. We do not actually *have* to throw away
|
|
116538
|
-
// the "noDiagnosticsTypeChecker". However, for simplicity, i'd like to keep
|
|
116539
|
-
// the lifetimes of these two TypeCheckers the same. Also, we generally only
|
|
116540
|
-
// cancel when the user has made a change anyways. And, in that case, we (the
|
|
116541
|
-
// program instance) will get thrown away anyways. So trying to keep one of
|
|
116542
|
-
// these type checkers alive doesn't serve much purpose.
|
|
116543
|
-
noDiagnosticsTypeChecker = undefined;
|
|
116544
|
-
diagnosticsProducingTypeChecker = undefined;
|
|
116597
|
+
typeChecker = undefined;
|
|
116545
116598
|
}
|
|
116546
116599
|
throw e;
|
|
116547
116600
|
}
|
|
@@ -116557,7 +116610,7 @@ var ts;
|
|
|
116557
116610
|
if (ts.skipTypeChecking(sourceFile, options, program)) {
|
|
116558
116611
|
return ts.emptyArray;
|
|
116559
116612
|
}
|
|
116560
|
-
var typeChecker =
|
|
116613
|
+
var typeChecker = getTypeChecker();
|
|
116561
116614
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
116562
116615
|
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
116563
116616
|
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
@@ -116609,7 +116662,7 @@ var ts;
|
|
|
116609
116662
|
}
|
|
116610
116663
|
function getSuggestionDiagnostics(sourceFile, cancellationToken) {
|
|
116611
116664
|
return runWithCancellationToken(function () {
|
|
116612
|
-
return
|
|
116665
|
+
return getTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken);
|
|
116613
116666
|
});
|
|
116614
116667
|
}
|
|
116615
116668
|
/**
|
|
@@ -116829,7 +116882,7 @@ var ts;
|
|
|
116829
116882
|
}
|
|
116830
116883
|
function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
|
|
116831
116884
|
return runWithCancellationToken(function () {
|
|
116832
|
-
var resolver =
|
|
116885
|
+
var resolver = getTypeChecker().getEmitResolver(sourceFile, cancellationToken);
|
|
116833
116886
|
// Don't actually write any files since we're just getting diagnostics.
|
|
116834
116887
|
return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) || ts.emptyArray;
|
|
116835
116888
|
});
|
|
@@ -116867,7 +116920,7 @@ var ts;
|
|
|
116867
116920
|
return diagnostics;
|
|
116868
116921
|
}
|
|
116869
116922
|
function getGlobalDiagnostics() {
|
|
116870
|
-
return rootNames.length ? ts.sortAndDeduplicateDiagnostics(
|
|
116923
|
+
return rootNames.length ? ts.sortAndDeduplicateDiagnostics(getTypeChecker().getGlobalDiagnostics().slice()) : ts.emptyArray;
|
|
116871
116924
|
}
|
|
116872
116925
|
function getConfigFileParsingDiagnostics() {
|
|
116873
116926
|
return configFileParsingDiagnostics || ts.emptyArray;
|
|
@@ -133572,9 +133625,14 @@ var ts;
|
|
|
133572
133625
|
if (type) {
|
|
133573
133626
|
return type;
|
|
133574
133627
|
}
|
|
133575
|
-
|
|
133628
|
+
var parent = ts.walkUpParenthesizedExpressions(node.parent);
|
|
133629
|
+
if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 63 /* EqualsToken */ && node === parent.left) {
|
|
133576
133630
|
// Object literal is assignment pattern: ({ | } = x)
|
|
133577
|
-
return typeChecker.getTypeAtLocation(
|
|
133631
|
+
return typeChecker.getTypeAtLocation(parent);
|
|
133632
|
+
}
|
|
133633
|
+
if (ts.isExpression(parent)) {
|
|
133634
|
+
// f(() => (({ | })));
|
|
133635
|
+
return typeChecker.getContextualType(parent);
|
|
133578
133636
|
}
|
|
133579
133637
|
return undefined;
|
|
133580
133638
|
}
|
|
@@ -134367,8 +134425,24 @@ var ts;
|
|
|
134367
134425
|
};
|
|
134368
134426
|
}
|
|
134369
134427
|
ts.createDocumentRegistryInternal = createDocumentRegistryInternal;
|
|
134428
|
+
function compilerOptionValueToString(value) {
|
|
134429
|
+
var _a;
|
|
134430
|
+
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
134431
|
+
return "" + value;
|
|
134432
|
+
}
|
|
134433
|
+
if (ts.isArray(value)) {
|
|
134434
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
134435
|
+
}
|
|
134436
|
+
var str = "{";
|
|
134437
|
+
for (var key in value) {
|
|
134438
|
+
if (ts.hasOwnProperty.call(value, key)) { // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier
|
|
134439
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
134440
|
+
}
|
|
134441
|
+
}
|
|
134442
|
+
return str + "}";
|
|
134443
|
+
}
|
|
134370
134444
|
function getKeyForCompilationSettings(settings) {
|
|
134371
|
-
return ts.sourceFileAffectingCompilerOptions.map(function (option) { return ts.getCompilerOptionValue(settings, option); }).join("|");
|
|
134445
|
+
return ts.sourceFileAffectingCompilerOptions.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + (settings.pathsBasePath ? "|" + settings.pathsBasePath : undefined);
|
|
134372
134446
|
}
|
|
134373
134447
|
})(ts || (ts = {}));
|
|
134374
134448
|
/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */
|
|
@@ -146153,7 +146227,28 @@ var ts;
|
|
|
146153
146227
|
// indentation is first non-whitespace character in a previous line
|
|
146154
146228
|
// for block indentation, we should look for a line which contains something that's not
|
|
146155
146229
|
// whitespace.
|
|
146156
|
-
|
|
146230
|
+
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
|
146231
|
+
// for object literal, we want to the indentation work like block
|
|
146232
|
+
// if { starts in any position (can be in the middle of line)
|
|
146233
|
+
// the following indentation should treat { as starting of that line (including leading whitespace)
|
|
146234
|
+
// ```
|
|
146235
|
+
// const a: { x: undefined, y: undefined } = {} // leading 4 whitespaces and { starts in the middle of line
|
|
146236
|
+
// ->
|
|
146237
|
+
// const a: { x: undefined, y: undefined } = {
|
|
146238
|
+
// x: undefined,
|
|
146239
|
+
// y: undefined,
|
|
146240
|
+
// }
|
|
146241
|
+
// ---------------------
|
|
146242
|
+
// const a: {x : undefined, y: undefined } =
|
|
146243
|
+
// {}
|
|
146244
|
+
// ->
|
|
146245
|
+
// const a: { x: undefined, y: undefined } =
|
|
146246
|
+
// { // leading 5 whitespaces and { starts at 6 column
|
|
146247
|
+
// x: undefined,
|
|
146248
|
+
// y: undefined,
|
|
146249
|
+
// }
|
|
146250
|
+
// ```
|
|
146251
|
+
if (options.indentStyle === ts.IndentStyle.Block || currentToken.kind === 18 /* OpenBraceToken */) {
|
|
146157
146252
|
return getBlockIndent(sourceFile, position, options);
|
|
146158
146253
|
}
|
|
146159
146254
|
if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 221 /* BinaryExpression */) {
|
|
@@ -147096,7 +147191,7 @@ var ts;
|
|
|
147096
147191
|
}
|
|
147097
147192
|
var startPosition = ts.getPrecedingNonSpaceCharacterPosition(sourceFile.text, fnStart - 1);
|
|
147098
147193
|
var indent = sourceFile.text.slice(startPosition, fnStart);
|
|
147099
|
-
this.insertNodeAt(sourceFile, fnStart, tag, {
|
|
147194
|
+
this.insertNodeAt(sourceFile, fnStart, tag, { suffix: this.newLineCharacter + indent });
|
|
147100
147195
|
};
|
|
147101
147196
|
ChangeTracker.prototype.createJSDocText = function (sourceFile, node) {
|
|
147102
147197
|
var comments = ts.flatMap(node.jsDoc, function (jsDoc) {
|
|
@@ -147627,7 +147722,7 @@ var ts;
|
|
|
147627
147722
|
? change.nodes.map(function (n) { return ts.removeSuffix(format(n), newLineCharacter); }).join(((_a = change.options) === null || _a === void 0 ? void 0 : _a.joiner) || newLineCharacter)
|
|
147628
147723
|
: format(change.node);
|
|
147629
147724
|
// strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line
|
|
147630
|
-
var noIndent = (options.
|
|
147725
|
+
var noIndent = (options.indentation !== undefined || ts.getLineStartPositionForPosition(pos, sourceFile) === pos) ? text : text.replace(/^\s+/, "");
|
|
147631
147726
|
return (options.prefix || "") + noIndent
|
|
147632
147727
|
+ ((!options.suffix || ts.endsWith(noIndent, options.suffix))
|
|
147633
147728
|
? "" : options.suffix);
|
|
@@ -148320,7 +148415,7 @@ var ts;
|
|
|
148320
148415
|
errorCodes: errorCodes,
|
|
148321
148416
|
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
|
|
148322
148417
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
|
|
148323
|
-
var diagnostic = ts.find(program.
|
|
148418
|
+
var diagnostic = ts.find(program.getTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
|
|
148324
148419
|
var directSpan = diagnostic && diagnostic.relatedInformation && ts.find(diagnostic.relatedInformation, function (r) { return r.code === ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; });
|
|
148325
148420
|
var decl = getFixableErrorSpanDeclaration(sourceFile, directSpan);
|
|
148326
148421
|
if (!decl) {
|
|
@@ -148474,7 +148569,7 @@ var ts;
|
|
|
148474
148569
|
return codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_await, fixId, ts.Diagnostics.Fix_all_expressions_possibly_missing_await);
|
|
148475
148570
|
}
|
|
148476
148571
|
function isMissingAwaitError(sourceFile, errorCode, span, cancellationToken, program) {
|
|
148477
|
-
var checker = program.
|
|
148572
|
+
var checker = program.getTypeChecker();
|
|
148478
148573
|
var diagnostics = checker.getDiagnostics(sourceFile, cancellationToken);
|
|
148479
148574
|
return ts.some(diagnostics, function (_a) {
|
|
148480
148575
|
var start = _a.start, length = _a.length, relatedInformation = _a.relatedInformation, code = _a.code;
|
|
@@ -149141,20 +149236,6 @@ var ts;
|
|
|
149141
149236
|
}
|
|
149142
149237
|
function createClassElementsFromSymbol(symbol) {
|
|
149143
149238
|
var memberElements = [];
|
|
149144
|
-
// all instance members are stored in the "member" array of symbol
|
|
149145
|
-
if (symbol.members) {
|
|
149146
|
-
symbol.members.forEach(function (member, key) {
|
|
149147
|
-
if (key === "constructor" && member.valueDeclaration) {
|
|
149148
|
-
// fn.prototype.constructor = fn
|
|
149149
|
-
changes.delete(sourceFile, member.valueDeclaration.parent);
|
|
149150
|
-
return;
|
|
149151
|
-
}
|
|
149152
|
-
var memberElement = createClassElement(member, /*modifiers*/ undefined);
|
|
149153
|
-
if (memberElement) {
|
|
149154
|
-
memberElements.push.apply(memberElements, memberElement);
|
|
149155
|
-
}
|
|
149156
|
-
});
|
|
149157
|
-
}
|
|
149158
149239
|
// all static members are stored in the "exports" array of symbol
|
|
149159
149240
|
if (symbol.exports) {
|
|
149160
149241
|
symbol.exports.forEach(function (member) {
|
|
@@ -149167,18 +149248,31 @@ var ts;
|
|
|
149167
149248
|
firstDeclaration.parent.operatorToken.kind === 63 /* EqualsToken */ &&
|
|
149168
149249
|
ts.isObjectLiteralExpression(firstDeclaration.parent.right)) {
|
|
149169
149250
|
var prototypes = firstDeclaration.parent.right;
|
|
149170
|
-
|
|
149171
|
-
if (memberElement) {
|
|
149172
|
-
memberElements.push.apply(memberElements, memberElement);
|
|
149173
|
-
}
|
|
149251
|
+
createClassElement(prototypes.symbol, /** modifiers */ undefined, memberElements);
|
|
149174
149252
|
}
|
|
149175
149253
|
}
|
|
149176
149254
|
else {
|
|
149177
|
-
|
|
149178
|
-
|
|
149179
|
-
|
|
149255
|
+
createClassElement(member, [ts.factory.createToken(124 /* StaticKeyword */)], memberElements);
|
|
149256
|
+
}
|
|
149257
|
+
});
|
|
149258
|
+
}
|
|
149259
|
+
// all instance members are stored in the "member" array of symbol (done last so instance members pulled from prototype assignments have priority)
|
|
149260
|
+
if (symbol.members) {
|
|
149261
|
+
symbol.members.forEach(function (member, key) {
|
|
149262
|
+
var _a, _b, _c, _d;
|
|
149263
|
+
if (key === "constructor" && member.valueDeclaration) {
|
|
149264
|
+
var prototypeAssignment = (_d = (_c = (_b = (_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.get("prototype")) === null || _b === void 0 ? void 0 : _b.declarations) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.parent;
|
|
149265
|
+
if (prototypeAssignment && ts.isBinaryExpression(prototypeAssignment) && ts.isObjectLiteralExpression(prototypeAssignment.right) && ts.some(prototypeAssignment.right.properties, isConstructorAssignment)) {
|
|
149266
|
+
// fn.prototype = { constructor: fn }
|
|
149267
|
+
// Already deleted in `createClassElement` in first pass
|
|
149268
|
+
}
|
|
149269
|
+
else {
|
|
149270
|
+
// fn.prototype.constructor = fn
|
|
149271
|
+
changes.delete(sourceFile, member.valueDeclaration.parent);
|
|
149180
149272
|
}
|
|
149273
|
+
return;
|
|
149181
149274
|
}
|
|
149275
|
+
createClassElement(member, /*modifiers*/ undefined, memberElements);
|
|
149182
149276
|
});
|
|
149183
149277
|
}
|
|
149184
149278
|
return memberElements;
|
|
@@ -149206,18 +149300,26 @@ var ts;
|
|
|
149206
149300
|
});
|
|
149207
149301
|
}
|
|
149208
149302
|
}
|
|
149209
|
-
function createClassElement(symbol, modifiers) {
|
|
149303
|
+
function createClassElement(symbol, modifiers, members) {
|
|
149210
149304
|
// Right now the only thing we can convert are function expressions, which are marked as methods
|
|
149211
149305
|
// or { x: y } type prototype assignments, which are marked as ObjectLiteral
|
|
149212
|
-
var members = [];
|
|
149213
149306
|
if (!(symbol.flags & 8192 /* Method */) && !(symbol.flags & 4096 /* ObjectLiteral */)) {
|
|
149214
|
-
return
|
|
149307
|
+
return;
|
|
149215
149308
|
}
|
|
149216
149309
|
var memberDeclaration = symbol.valueDeclaration;
|
|
149217
149310
|
var assignmentBinaryExpression = memberDeclaration.parent;
|
|
149218
149311
|
var assignmentExpr = assignmentBinaryExpression.right;
|
|
149219
149312
|
if (!shouldConvertDeclaration(memberDeclaration, assignmentExpr)) {
|
|
149220
|
-
return
|
|
149313
|
+
return;
|
|
149314
|
+
}
|
|
149315
|
+
if (ts.some(members, function (m) {
|
|
149316
|
+
var name = ts.getNameOfDeclaration(m);
|
|
149317
|
+
if (name && ts.isIdentifier(name) && ts.idText(name) === ts.symbolName(symbol)) {
|
|
149318
|
+
return true; // class member already made for this name
|
|
149319
|
+
}
|
|
149320
|
+
return false;
|
|
149321
|
+
})) {
|
|
149322
|
+
return;
|
|
149221
149323
|
}
|
|
149222
149324
|
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
|
|
149223
149325
|
var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* ExpressionStatement */
|
|
@@ -149226,43 +149328,44 @@ var ts;
|
|
|
149226
149328
|
if (!assignmentExpr) {
|
|
149227
149329
|
members.push(ts.factory.createPropertyDeclaration([], modifiers, symbol.name, /*questionToken*/ undefined,
|
|
149228
149330
|
/*type*/ undefined, /*initializer*/ undefined));
|
|
149229
|
-
return
|
|
149331
|
+
return;
|
|
149230
149332
|
}
|
|
149231
149333
|
// f.x = expr
|
|
149232
149334
|
if (ts.isAccessExpression(memberDeclaration) && (ts.isFunctionExpression(assignmentExpr) || ts.isArrowFunction(assignmentExpr))) {
|
|
149233
149335
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
149234
149336
|
var name = tryGetPropertyName(memberDeclaration, compilerOptions, quotePreference);
|
|
149235
149337
|
if (name) {
|
|
149236
|
-
|
|
149338
|
+
createFunctionLikeExpressionMember(members, assignmentExpr, name);
|
|
149237
149339
|
}
|
|
149238
|
-
return
|
|
149340
|
+
return;
|
|
149239
149341
|
}
|
|
149240
149342
|
// f.prototype = { ... }
|
|
149241
149343
|
else if (ts.isObjectLiteralExpression(assignmentExpr)) {
|
|
149242
|
-
|
|
149344
|
+
ts.forEach(assignmentExpr.properties, function (property) {
|
|
149243
149345
|
if (ts.isMethodDeclaration(property) || ts.isGetOrSetAccessorDeclaration(property)) {
|
|
149244
149346
|
// MethodDeclaration and AccessorDeclaration can appear in a class directly
|
|
149245
|
-
|
|
149347
|
+
members.push(property);
|
|
149246
149348
|
}
|
|
149247
149349
|
if (ts.isPropertyAssignment(property) && ts.isFunctionExpression(property.initializer)) {
|
|
149248
|
-
|
|
149350
|
+
createFunctionLikeExpressionMember(members, property.initializer, property.name);
|
|
149249
149351
|
}
|
|
149250
149352
|
// Drop constructor assignments
|
|
149251
149353
|
if (isConstructorAssignment(property))
|
|
149252
|
-
return
|
|
149253
|
-
return
|
|
149354
|
+
return;
|
|
149355
|
+
return;
|
|
149254
149356
|
});
|
|
149357
|
+
return;
|
|
149255
149358
|
}
|
|
149256
149359
|
else {
|
|
149257
149360
|
// Don't try to declare members in JavaScript files
|
|
149258
149361
|
if (ts.isSourceFileJS(sourceFile))
|
|
149259
|
-
return
|
|
149362
|
+
return;
|
|
149260
149363
|
if (!ts.isPropertyAccessExpression(memberDeclaration))
|
|
149261
|
-
return
|
|
149364
|
+
return;
|
|
149262
149365
|
var prop = ts.factory.createPropertyDeclaration(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined, /*type*/ undefined, assignmentExpr);
|
|
149263
149366
|
ts.copyLeadingComments(assignmentBinaryExpression.parent, prop, sourceFile);
|
|
149264
149367
|
members.push(prop);
|
|
149265
|
-
return
|
|
149368
|
+
return;
|
|
149266
149369
|
}
|
|
149267
149370
|
function createFunctionLikeExpressionMember(members, expression, name) {
|
|
149268
149371
|
if (ts.isFunctionExpression(expression))
|
|
@@ -149275,7 +149378,8 @@ var ts;
|
|
|
149275
149378
|
var method = ts.factory.createMethodDeclaration(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined,
|
|
149276
149379
|
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
|
|
149277
149380
|
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
|
|
149278
|
-
|
|
149381
|
+
members.push(method);
|
|
149382
|
+
return;
|
|
149279
149383
|
}
|
|
149280
149384
|
function createArrowFunctionExpressionMember(members, arrowFunction, name) {
|
|
149281
149385
|
var arrowFunctionBody = arrowFunction.body;
|
|
@@ -149292,7 +149396,7 @@ var ts;
|
|
|
149292
149396
|
var method = ts.factory.createMethodDeclaration(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined,
|
|
149293
149397
|
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
|
|
149294
149398
|
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
|
|
149295
|
-
|
|
149399
|
+
members.push(method);
|
|
149296
149400
|
}
|
|
149297
149401
|
}
|
|
149298
149402
|
}
|
|
@@ -152726,7 +152830,7 @@ var ts;
|
|
|
152726
152830
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getTypeAtLocation(param), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
152727
152831
|
if (!ts.length(properties))
|
|
152728
152832
|
return undefined;
|
|
152729
|
-
return { kind: 3 /* ObjectLiteral */, token: param.name, properties: properties,
|
|
152833
|
+
return { kind: 3 /* ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent };
|
|
152730
152834
|
}
|
|
152731
152835
|
if (!ts.isMemberName(token))
|
|
152732
152836
|
return undefined;
|
|
@@ -152734,7 +152838,7 @@ var ts;
|
|
|
152734
152838
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
152735
152839
|
if (!ts.length(properties))
|
|
152736
152840
|
return undefined;
|
|
152737
|
-
return { kind: 3 /* ObjectLiteral */, token: token, properties: properties,
|
|
152841
|
+
return { kind: 3 /* ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
152738
152842
|
}
|
|
152739
152843
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
152740
152844
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|