mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 21:37:41 -06:00
Update LKG
This commit is contained in:
parent
1120971a6e
commit
a29e8cf240
2
lib/lib.d.ts
vendored
2
lib/lib.d.ts
vendored
@ -160,7 +160,7 @@ interface ObjectConstructor {
|
||||
* Creates an object that has the specified prototype or that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null.
|
||||
*/
|
||||
create<T extends object>(o: T | null): T | object;
|
||||
create(o: object | null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
|
||||
2
lib/lib.es5.d.ts
vendored
2
lib/lib.es5.d.ts
vendored
@ -160,7 +160,7 @@ interface ObjectConstructor {
|
||||
* Creates an object that has the specified prototype or that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null.
|
||||
*/
|
||||
create<T extends object>(o: T | null): T | object;
|
||||
create(o: object | null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
|
||||
2
lib/lib.es6.d.ts
vendored
2
lib/lib.es6.d.ts
vendored
@ -160,7 +160,7 @@ interface ObjectConstructor {
|
||||
* Creates an object that has the specified prototype or that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null.
|
||||
*/
|
||||
create<T extends object>(o: T | null): T | object;
|
||||
create(o: object | null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
|
||||
@ -3347,7 +3347,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
@ -20115,6 +20117,8 @@ var ts;
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getBaseTypes: getBaseTypes,
|
||||
getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
|
||||
getWidenedType: getWidenedType,
|
||||
getTypeFromTypeNode: getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
|
||||
@ -4308,7 +4308,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
@ -21175,6 +21177,8 @@ var ts;
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getBaseTypes: getBaseTypes,
|
||||
getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
|
||||
getWidenedType: getWidenedType,
|
||||
getTypeFromTypeNode: getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
@ -59054,7 +59058,7 @@ var ts;
|
||||
var importDecl = importSpecifier.parent;
|
||||
ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier);
|
||||
var defaultName = importDecl.importClause.name;
|
||||
var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
var defaultReferencedSymbol = defaultName && checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
if (symbol === defaultReferencedSymbol) {
|
||||
return defaultName.text;
|
||||
}
|
||||
@ -65647,6 +65651,62 @@ var ts;
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code],
|
||||
getCodeActions: getActionsForAddMissingMember
|
||||
});
|
||||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind != 70) {
|
||||
return undefined;
|
||||
}
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (!(token.parent && token.parent.kind === 178)) {
|
||||
return undefined;
|
||||
}
|
||||
if (token.parent.expression.kind !== 98) {
|
||||
return undefined;
|
||||
}
|
||||
var typeString = "any";
|
||||
if (token.parent.parent.kind === 193) {
|
||||
var binaryExpression = token.parent.parent;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right)));
|
||||
typeString = checker.typeToString(widenedType);
|
||||
}
|
||||
var startPos = classDeclaration.members.pos;
|
||||
return [{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: token.getFullText(sourceFile) + ": " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: "[name: string]: " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@ -66456,7 +66516,7 @@ var ts;
|
||||
}
|
||||
var declaration = declarations[0];
|
||||
var name = declaration.name ? declaration.name.getText() : undefined;
|
||||
var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration));
|
||||
var visibility = getVisibilityPrefixWithSpace(ts.getModifierFlags(declaration));
|
||||
switch (declaration.kind) {
|
||||
case 152:
|
||||
case 153:
|
||||
@ -66473,7 +66533,7 @@ var ts;
|
||||
if (declarations.length === 1) {
|
||||
ts.Debug.assert(signatures.length === 1);
|
||||
var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048, 0);
|
||||
return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar);
|
||||
return getStubbedMethod(visibility, name, sigString_1, newlineChar);
|
||||
}
|
||||
var result = "";
|
||||
for (var i = 0; i < signatures.length; i++) {
|
||||
@ -66489,7 +66549,7 @@ var ts;
|
||||
bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker);
|
||||
}
|
||||
var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048, 0);
|
||||
result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
result += getStubbedMethod(visibility, name, sigString, newlineChar);
|
||||
return result;
|
||||
default:
|
||||
return "";
|
||||
@ -66538,10 +66598,15 @@ var ts;
|
||||
return newParameter;
|
||||
}
|
||||
}
|
||||
function getMethodBodyStub(newLineChar) {
|
||||
return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar;
|
||||
function getStubbedMethod(visibility, name, sigString, newlineChar) {
|
||||
if (sigString === void 0) { sigString = "()"; }
|
||||
return "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
}
|
||||
function getVisibilityPrefix(flags) {
|
||||
codefix.getStubbedMethod = getStubbedMethod;
|
||||
function getMethodBodyStub(newlineChar) {
|
||||
return " {" + newlineChar + "throw new Error('Method not implemented.');" + newlineChar + "}" + newlineChar;
|
||||
}
|
||||
function getVisibilityPrefixWithSpace(flags) {
|
||||
if (flags & 4) {
|
||||
return "public ";
|
||||
}
|
||||
|
||||
2
lib/tsserverlibrary.d.ts
vendored
2
lib/tsserverlibrary.d.ts
vendored
@ -1564,6 +1564,8 @@ declare namespace ts {
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): BaseType[];
|
||||
getBaseTypeOfLiteralType(type: Type): Type;
|
||||
getWidenedType(type: Type): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
|
||||
@ -4308,7 +4308,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
@ -22308,6 +22310,8 @@ var ts;
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getBaseTypes: getBaseTypes,
|
||||
getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
|
||||
getWidenedType: getWidenedType,
|
||||
getTypeFromTypeNode: getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
@ -59054,7 +59058,7 @@ var ts;
|
||||
var importDecl = importSpecifier.parent;
|
||||
ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier);
|
||||
var defaultName = importDecl.importClause.name;
|
||||
var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
var defaultReferencedSymbol = defaultName && checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
if (symbol === defaultReferencedSymbol) {
|
||||
return defaultName.text;
|
||||
}
|
||||
@ -65647,6 +65651,62 @@ var ts;
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code],
|
||||
getCodeActions: getActionsForAddMissingMember
|
||||
});
|
||||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind != 70) {
|
||||
return undefined;
|
||||
}
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (!(token.parent && token.parent.kind === 178)) {
|
||||
return undefined;
|
||||
}
|
||||
if (token.parent.expression.kind !== 98) {
|
||||
return undefined;
|
||||
}
|
||||
var typeString = "any";
|
||||
if (token.parent.parent.kind === 193) {
|
||||
var binaryExpression = token.parent.parent;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right)));
|
||||
typeString = checker.typeToString(widenedType);
|
||||
}
|
||||
var startPos = classDeclaration.members.pos;
|
||||
return [{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: token.getFullText(sourceFile) + ": " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: "[name: string]: " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@ -66456,7 +66516,7 @@ var ts;
|
||||
}
|
||||
var declaration = declarations[0];
|
||||
var name = declaration.name ? declaration.name.getText() : undefined;
|
||||
var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration));
|
||||
var visibility = getVisibilityPrefixWithSpace(ts.getModifierFlags(declaration));
|
||||
switch (declaration.kind) {
|
||||
case 152:
|
||||
case 153:
|
||||
@ -66473,7 +66533,7 @@ var ts;
|
||||
if (declarations.length === 1) {
|
||||
ts.Debug.assert(signatures.length === 1);
|
||||
var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048, 0);
|
||||
return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar);
|
||||
return getStubbedMethod(visibility, name, sigString_1, newlineChar);
|
||||
}
|
||||
var result = "";
|
||||
for (var i = 0; i < signatures.length; i++) {
|
||||
@ -66489,7 +66549,7 @@ var ts;
|
||||
bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker);
|
||||
}
|
||||
var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048, 0);
|
||||
result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
result += getStubbedMethod(visibility, name, sigString, newlineChar);
|
||||
return result;
|
||||
default:
|
||||
return "";
|
||||
@ -66538,10 +66598,15 @@ var ts;
|
||||
return newParameter;
|
||||
}
|
||||
}
|
||||
function getMethodBodyStub(newLineChar) {
|
||||
return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar;
|
||||
function getStubbedMethod(visibility, name, sigString, newlineChar) {
|
||||
if (sigString === void 0) { sigString = "()"; }
|
||||
return "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
}
|
||||
function getVisibilityPrefix(flags) {
|
||||
codefix.getStubbedMethod = getStubbedMethod;
|
||||
function getMethodBodyStub(newlineChar) {
|
||||
return " {" + newlineChar + "throw new Error('Method not implemented.');" + newlineChar + "}" + newlineChar;
|
||||
}
|
||||
function getVisibilityPrefixWithSpace(flags) {
|
||||
if (flags & 4) {
|
||||
return "public ";
|
||||
}
|
||||
|
||||
2
lib/typescript.d.ts
vendored
2
lib/typescript.d.ts
vendored
@ -1631,6 +1631,8 @@ declare namespace ts {
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): BaseType[];
|
||||
getBaseTypeOfLiteralType(type: Type): Type;
|
||||
getWidenedType(type: Type): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
|
||||
@ -4792,7 +4792,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
@ -24730,6 +24732,8 @@ var ts;
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getBaseTypes: getBaseTypes,
|
||||
getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
|
||||
getWidenedType: getWidenedType,
|
||||
getTypeFromTypeNode: getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
@ -71286,7 +71290,7 @@ var ts;
|
||||
var importDecl = importSpecifier.parent;
|
||||
ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier);
|
||||
var defaultName = importDecl.importClause.name;
|
||||
var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
var defaultReferencedSymbol = defaultName && checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
if (symbol === defaultReferencedSymbol) {
|
||||
return defaultName.text;
|
||||
}
|
||||
@ -79197,6 +79201,66 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code],
|
||||
getCodeActions: getActionsForAddMissingMember
|
||||
});
|
||||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
// This is the identifier of the missing property. eg:
|
||||
// this.missing = 1;
|
||||
// ^^^^^^^
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind != 70 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (!(token.parent && token.parent.kind === 178 /* PropertyAccessExpression */)) {
|
||||
return undefined;
|
||||
}
|
||||
if (token.parent.expression.kind !== 98 /* ThisKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
var typeString = "any";
|
||||
if (token.parent.parent.kind === 193 /* BinaryExpression */) {
|
||||
var binaryExpression = token.parent.parent;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right)));
|
||||
typeString = checker.typeToString(widenedType);
|
||||
}
|
||||
var startPos = classDeclaration.members.pos;
|
||||
return [{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: token.getFullText(sourceFile) + ": " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: "[name: string]: " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@ -80115,7 +80179,7 @@ var ts;
|
||||
}
|
||||
var declaration = declarations[0];
|
||||
var name = declaration.name ? declaration.name.getText() : undefined;
|
||||
var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration));
|
||||
var visibility = getVisibilityPrefixWithSpace(ts.getModifierFlags(declaration));
|
||||
switch (declaration.kind) {
|
||||
case 152 /* GetAccessor */:
|
||||
case 153 /* SetAccessor */:
|
||||
@ -80139,7 +80203,7 @@ var ts;
|
||||
if (declarations.length === 1) {
|
||||
ts.Debug.assert(signatures.length === 1);
|
||||
var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */);
|
||||
return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar);
|
||||
return getStubbedMethod(visibility, name, sigString_1, newlineChar);
|
||||
}
|
||||
var result = "";
|
||||
for (var i = 0; i < signatures.length; i++) {
|
||||
@ -80157,7 +80221,7 @@ var ts;
|
||||
bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker);
|
||||
}
|
||||
var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */);
|
||||
result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
result += getStubbedMethod(visibility, name, sigString, newlineChar);
|
||||
return result;
|
||||
default:
|
||||
return "";
|
||||
@ -80206,10 +80270,15 @@ var ts;
|
||||
return newParameter;
|
||||
}
|
||||
}
|
||||
function getMethodBodyStub(newLineChar) {
|
||||
return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar;
|
||||
function getStubbedMethod(visibility, name, sigString, newlineChar) {
|
||||
if (sigString === void 0) { sigString = "()"; }
|
||||
return "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
}
|
||||
function getVisibilityPrefix(flags) {
|
||||
codefix.getStubbedMethod = getStubbedMethod;
|
||||
function getMethodBodyStub(newlineChar) {
|
||||
return " {" + newlineChar + "throw new Error('Method not implemented.');" + newlineChar + "}" + newlineChar;
|
||||
}
|
||||
function getVisibilityPrefixWithSpace(flags) {
|
||||
if (flags & 4 /* Public */) {
|
||||
return "public ";
|
||||
}
|
||||
@ -80222,6 +80291,7 @@ var ts;
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="fixClassIncorrectlyImplementsInterface.ts" />
|
||||
/// <reference path="fixAddMissingMember.ts" />
|
||||
/// <reference path="fixClassDoesntImplementInheritedAbstractMember.ts" />
|
||||
/// <reference path="fixClassSuperMustPrecedeThisAccess.ts" />
|
||||
/// <reference path="fixConstructorForDerivedNeedSuperCall.ts" />
|
||||
|
||||
2
lib/typescriptServices.d.ts
vendored
2
lib/typescriptServices.d.ts
vendored
@ -1631,6 +1631,8 @@ declare namespace ts {
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getBaseTypes(type: InterfaceType): BaseType[];
|
||||
getBaseTypeOfLiteralType(type: Type): Type;
|
||||
getWidenedType(type: Type): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
|
||||
@ -4792,7 +4792,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
@ -24730,6 +24732,8 @@ var ts;
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getBaseTypes: getBaseTypes,
|
||||
getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
|
||||
getWidenedType: getWidenedType,
|
||||
getTypeFromTypeNode: getTypeFromTypeNode,
|
||||
getParameterType: getTypeAtPosition,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
@ -71286,7 +71290,7 @@ var ts;
|
||||
var importDecl = importSpecifier.parent;
|
||||
ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier);
|
||||
var defaultName = importDecl.importClause.name;
|
||||
var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
var defaultReferencedSymbol = defaultName && checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
|
||||
if (symbol === defaultReferencedSymbol) {
|
||||
return defaultName.text;
|
||||
}
|
||||
@ -79197,6 +79201,66 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code],
|
||||
getCodeActions: getActionsForAddMissingMember
|
||||
});
|
||||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
// This is the identifier of the missing property. eg:
|
||||
// this.missing = 1;
|
||||
// ^^^^^^^
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind != 70 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (!(token.parent && token.parent.kind === 178 /* PropertyAccessExpression */)) {
|
||||
return undefined;
|
||||
}
|
||||
if (token.parent.expression.kind !== 98 /* ThisKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
var typeString = "any";
|
||||
if (token.parent.parent.kind === 193 /* BinaryExpression */) {
|
||||
var binaryExpression = token.parent.parent;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right)));
|
||||
typeString = checker.typeToString(widenedType);
|
||||
}
|
||||
var startPos = classDeclaration.members.pos;
|
||||
return [{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: token.getFullText(sourceFile) + ": " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]),
|
||||
changes: [{
|
||||
fileName: sourceFile.fileName,
|
||||
textChanges: [{
|
||||
span: { start: startPos, length: 0 },
|
||||
newText: "[name: string]: " + typeString + ";"
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@ -80115,7 +80179,7 @@ var ts;
|
||||
}
|
||||
var declaration = declarations[0];
|
||||
var name = declaration.name ? declaration.name.getText() : undefined;
|
||||
var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration));
|
||||
var visibility = getVisibilityPrefixWithSpace(ts.getModifierFlags(declaration));
|
||||
switch (declaration.kind) {
|
||||
case 152 /* GetAccessor */:
|
||||
case 153 /* SetAccessor */:
|
||||
@ -80139,7 +80203,7 @@ var ts;
|
||||
if (declarations.length === 1) {
|
||||
ts.Debug.assert(signatures.length === 1);
|
||||
var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */);
|
||||
return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar);
|
||||
return getStubbedMethod(visibility, name, sigString_1, newlineChar);
|
||||
}
|
||||
var result = "";
|
||||
for (var i = 0; i < signatures.length; i++) {
|
||||
@ -80157,7 +80221,7 @@ var ts;
|
||||
bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker);
|
||||
}
|
||||
var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */);
|
||||
result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
result += getStubbedMethod(visibility, name, sigString, newlineChar);
|
||||
return result;
|
||||
default:
|
||||
return "";
|
||||
@ -80206,10 +80270,15 @@ var ts;
|
||||
return newParameter;
|
||||
}
|
||||
}
|
||||
function getMethodBodyStub(newLineChar) {
|
||||
return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar;
|
||||
function getStubbedMethod(visibility, name, sigString, newlineChar) {
|
||||
if (sigString === void 0) { sigString = "()"; }
|
||||
return "" + visibility + name + sigString + getMethodBodyStub(newlineChar);
|
||||
}
|
||||
function getVisibilityPrefix(flags) {
|
||||
codefix.getStubbedMethod = getStubbedMethod;
|
||||
function getMethodBodyStub(newlineChar) {
|
||||
return " {" + newlineChar + "throw new Error('Method not implemented.');" + newlineChar + "}" + newlineChar;
|
||||
}
|
||||
function getVisibilityPrefixWithSpace(flags) {
|
||||
if (flags & 4 /* Public */) {
|
||||
return "public ";
|
||||
}
|
||||
@ -80222,6 +80291,7 @@ var ts;
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="fixClassIncorrectlyImplementsInterface.ts" />
|
||||
/// <reference path="fixAddMissingMember.ts" />
|
||||
/// <reference path="fixClassDoesntImplementInheritedAbstractMember.ts" />
|
||||
/// <reference path="fixClassSuperMustPrecedeThisAccess.ts" />
|
||||
/// <reference path="fixConstructorForDerivedNeedSuperCall.ts" />
|
||||
|
||||
@ -3357,7 +3357,9 @@ var ts;
|
||||
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
|
||||
Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
|
||||
Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
|
||||
Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." },
|
||||
Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." },
|
||||
Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'" },
|
||||
Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." },
|
||||
Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." },
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user