mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 17:41:26 -06:00
Update LKG
This commit is contained in:
parent
63369251b6
commit
61a404d3e5
136
bin/tsc.js
136
bin/tsc.js
@ -1277,6 +1277,8 @@ var ts;
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@ -1431,7 +1433,6 @@ var ts;
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
@ -8583,7 +8584,6 @@ var ts;
|
||||
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
|
||||
var nullType = createIntrinsicType(64 | 262144, "null");
|
||||
var unknownType = createIntrinsicType(1, "unknown");
|
||||
var resolvingType = createIntrinsicType(1, "__resolving__");
|
||||
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@ -8613,6 +8613,8 @@ var ts;
|
||||
var emitExtends = false;
|
||||
var emitDecorate = false;
|
||||
var emitParam = false;
|
||||
var resolutionTargets = [];
|
||||
var resolutionResults = [];
|
||||
var mergedSymbols = [];
|
||||
var symbolLinks = [];
|
||||
var nodeLinks = [];
|
||||
@ -8832,9 +8834,9 @@ var ts;
|
||||
}
|
||||
else if (location.kind === 228 ||
|
||||
(location.kind === 206 && location.name.kind === 8)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@ -9163,7 +9165,8 @@ var ts;
|
||||
}
|
||||
var symbol;
|
||||
if (name.kind === 65) {
|
||||
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
|
||||
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
|
||||
symbol = resolveName(name, name.text, meaning, message, name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@ -10134,6 +10137,26 @@ var ts;
|
||||
});
|
||||
}
|
||||
}
|
||||
function pushTypeResolution(target) {
|
||||
var i = 0;
|
||||
var count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
} while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
function popTypeResolution() {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
@ -10311,20 +10334,23 @@ var ts;
|
||||
if (declaration.kind === 215) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var diagnostic = symbol.valueDeclaration.type ?
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@ -10345,13 +10371,10 @@ var ts;
|
||||
}
|
||||
function getTypeOfAccessors(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
function checkAndStoreTypeOfAccessors(symbol, links) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
var setter = ts.getDeclarationOfKind(symbol, 138);
|
||||
var type;
|
||||
@ -10376,17 +10399,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@ -10548,17 +10570,16 @@ var ts;
|
||||
function getDeclaredTypeOfTypeAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@ -11097,7 +11118,9 @@ var ts;
|
||||
}
|
||||
function getReturnTypeOfSignature(signature) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@ -11108,21 +11131,19 @@ var ts;
|
||||
else {
|
||||
type = getReturnTypeFromBody(signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
@ -14372,10 +14393,9 @@ var ts;
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
var returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@ -15156,7 +15176,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
|
||||
142
bin/tsserver.js
142
bin/tsserver.js
@ -1277,6 +1277,8 @@ var ts;
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@ -1431,7 +1433,6 @@ var ts;
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
@ -8967,7 +8968,6 @@ var ts;
|
||||
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
|
||||
var nullType = createIntrinsicType(64 | 262144, "null");
|
||||
var unknownType = createIntrinsicType(1, "unknown");
|
||||
var resolvingType = createIntrinsicType(1, "__resolving__");
|
||||
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@ -8997,6 +8997,8 @@ var ts;
|
||||
var emitExtends = false;
|
||||
var emitDecorate = false;
|
||||
var emitParam = false;
|
||||
var resolutionTargets = [];
|
||||
var resolutionResults = [];
|
||||
var mergedSymbols = [];
|
||||
var symbolLinks = [];
|
||||
var nodeLinks = [];
|
||||
@ -9216,9 +9218,9 @@ var ts;
|
||||
}
|
||||
else if (location.kind === 228 ||
|
||||
(location.kind === 206 && location.name.kind === 8)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@ -9547,7 +9549,8 @@ var ts;
|
||||
}
|
||||
var symbol;
|
||||
if (name.kind === 65) {
|
||||
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
|
||||
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
|
||||
symbol = resolveName(name, name.text, meaning, message, name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@ -10518,6 +10521,26 @@ var ts;
|
||||
});
|
||||
}
|
||||
}
|
||||
function pushTypeResolution(target) {
|
||||
var i = 0;
|
||||
var count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
} while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
function popTypeResolution() {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
@ -10695,20 +10718,23 @@ var ts;
|
||||
if (declaration.kind === 215) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var diagnostic = symbol.valueDeclaration.type ?
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@ -10729,13 +10755,10 @@ var ts;
|
||||
}
|
||||
function getTypeOfAccessors(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
function checkAndStoreTypeOfAccessors(symbol, links) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
var setter = ts.getDeclarationOfKind(symbol, 138);
|
||||
var type;
|
||||
@ -10760,17 +10783,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@ -10932,17 +10954,16 @@ var ts;
|
||||
function getDeclaredTypeOfTypeAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@ -11481,7 +11502,9 @@ var ts;
|
||||
}
|
||||
function getReturnTypeOfSignature(signature) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@ -11492,21 +11515,19 @@ var ts;
|
||||
else {
|
||||
type = getReturnTypeFromBody(signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
@ -14756,10 +14777,9 @@ var ts;
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
var returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@ -15540,7 +15560,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
@ -36854,11 +36874,11 @@ var ts;
|
||||
configFilename = ts.normalizePath(configFilename);
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var rawConfig = ts.readConfigFile(configFilename);
|
||||
if (!rawConfig) {
|
||||
return { errorMsg: "tsconfig syntax error" };
|
||||
if (rawConfig.error) {
|
||||
return rawConfig.error;
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { errorMsg: "tsconfig option errors" };
|
||||
}
|
||||
|
||||
@ -2020,6 +2020,8 @@ var ts;
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@ -2174,7 +2176,6 @@ var ts;
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
@ -10804,7 +10805,6 @@ var ts;
|
||||
var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined");
|
||||
var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null");
|
||||
var unknownType = createIntrinsicType(1 /* Any */, "unknown");
|
||||
var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__");
|
||||
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@ -10834,6 +10834,8 @@ var ts;
|
||||
var emitExtends = false;
|
||||
var emitDecorate = false;
|
||||
var emitParam = false;
|
||||
var resolutionTargets = [];
|
||||
var resolutionResults = [];
|
||||
var mergedSymbols = [];
|
||||
var symbolLinks = [];
|
||||
var nodeLinks = [];
|
||||
@ -11063,9 +11065,9 @@ var ts;
|
||||
}
|
||||
else if (location.kind === 228 /* SourceFile */ ||
|
||||
(location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@ -11481,7 +11483,8 @@ var ts;
|
||||
}
|
||||
var symbol;
|
||||
if (name.kind === 65 /* Identifier */) {
|
||||
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
|
||||
var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
|
||||
symbol = resolveName(name, name.text, meaning, message, name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@ -12573,6 +12576,35 @@ var ts;
|
||||
});
|
||||
}
|
||||
}
|
||||
// Push an entry on the type resolution stack. If an entry with the given target is not already on the stack,
|
||||
// a new entry with that target and an associated result value of true is pushed on the stack, and the value
|
||||
// true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and
|
||||
// all entries pushed after it are changed to false, and the value false is returned. The target object provides
|
||||
// a unique identity for a particular type resolution result: Symbol instances are used to track resolution of
|
||||
// SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and
|
||||
// Signature instances are used to track resolution of Signature.resolvedReturnType.
|
||||
function pushTypeResolution(target) {
|
||||
var i = 0;
|
||||
var count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
} while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
// Pop an entry from the type resolution stack and return its associated result value. The result value will
|
||||
// be true if no circularities were detected, or false if a circularity was found.
|
||||
function popTypeResolution() {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
@ -12815,20 +12847,25 @@ var ts;
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var diagnostic = symbol.valueDeclaration.type ?
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
// Variable has type annotation that circularly references the variable itself
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
// Variable has initializer that circularly references the variable itself
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@ -12849,13 +12886,10 @@ var ts;
|
||||
}
|
||||
function getTypeOfAccessors(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
function checkAndStoreTypeOfAccessors(symbol, links) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */);
|
||||
var type;
|
||||
@ -12883,17 +12917,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@ -13058,17 +13091,18 @@ var ts;
|
||||
function getDeclaredTypeOfTypeAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
// Note that we use the links object as the target here because the symbol object is used as the unique
|
||||
// identity for resolution of the 'type' property in SymbolLinks.
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@ -13634,7 +13668,9 @@ var ts;
|
||||
}
|
||||
function getReturnTypeOfSignature(signature) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@ -13645,21 +13681,19 @@ var ts;
|
||||
else {
|
||||
type = getReturnTypeFromBody(signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
@ -17486,10 +17520,9 @@ var ts;
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
var returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@ -18405,7 +18438,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
@ -41620,7 +41653,7 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@ -42190,7 +42223,7 @@ var ts;
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: realizeDiagnostics(configFile.errors, '\r\n')
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@ -2020,6 +2020,8 @@ var ts;
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@ -2174,7 +2176,6 @@ var ts;
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
@ -10804,7 +10805,6 @@ var ts;
|
||||
var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined");
|
||||
var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null");
|
||||
var unknownType = createIntrinsicType(1 /* Any */, "unknown");
|
||||
var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__");
|
||||
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@ -10834,6 +10834,8 @@ var ts;
|
||||
var emitExtends = false;
|
||||
var emitDecorate = false;
|
||||
var emitParam = false;
|
||||
var resolutionTargets = [];
|
||||
var resolutionResults = [];
|
||||
var mergedSymbols = [];
|
||||
var symbolLinks = [];
|
||||
var nodeLinks = [];
|
||||
@ -11063,9 +11065,9 @@ var ts;
|
||||
}
|
||||
else if (location.kind === 228 /* SourceFile */ ||
|
||||
(location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@ -11481,7 +11483,8 @@ var ts;
|
||||
}
|
||||
var symbol;
|
||||
if (name.kind === 65 /* Identifier */) {
|
||||
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
|
||||
var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
|
||||
symbol = resolveName(name, name.text, meaning, message, name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@ -12573,6 +12576,35 @@ var ts;
|
||||
});
|
||||
}
|
||||
}
|
||||
// Push an entry on the type resolution stack. If an entry with the given target is not already on the stack,
|
||||
// a new entry with that target and an associated result value of true is pushed on the stack, and the value
|
||||
// true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and
|
||||
// all entries pushed after it are changed to false, and the value false is returned. The target object provides
|
||||
// a unique identity for a particular type resolution result: Symbol instances are used to track resolution of
|
||||
// SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and
|
||||
// Signature instances are used to track resolution of Signature.resolvedReturnType.
|
||||
function pushTypeResolution(target) {
|
||||
var i = 0;
|
||||
var count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
} while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
// Pop an entry from the type resolution stack and return its associated result value. The result value will
|
||||
// be true if no circularities were detected, or false if a circularity was found.
|
||||
function popTypeResolution() {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153 /* BindingElement */) {
|
||||
node = node.parent.parent;
|
||||
@ -12815,20 +12847,25 @@ var ts;
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var diagnostic = symbol.valueDeclaration.type ?
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
// Variable has type annotation that circularly references the variable itself
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
// Variable has initializer that circularly references the variable itself
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@ -12849,13 +12886,10 @@ var ts;
|
||||
}
|
||||
function getTypeOfAccessors(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
function checkAndStoreTypeOfAccessors(symbol, links) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */);
|
||||
var type;
|
||||
@ -12883,17 +12917,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */);
|
||||
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@ -13058,17 +13091,18 @@ var ts;
|
||||
function getDeclaredTypeOfTypeAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
// Note that we use the links object as the target here because the symbol object is used as the unique
|
||||
// identity for resolution of the 'type' property in SymbolLinks.
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */);
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@ -13634,7 +13668,9 @@ var ts;
|
||||
}
|
||||
function getReturnTypeOfSignature(signature) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@ -13645,21 +13681,19 @@ var ts;
|
||||
else {
|
||||
type = getReturnTypeFromBody(signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
@ -17486,10 +17520,9 @@ var ts;
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
var returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@ -18405,7 +18438,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
@ -41620,7 +41653,7 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@ -42190,7 +42223,7 @@ var ts;
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: realizeDiagnostics(configFile.errors, '\r\n')
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user