Merge branch 'master' into baseZero

Conflicts:
	src/harness/harnessLanguageService.ts
This commit is contained in:
Cyrus Najmabadi
2015-02-20 16:56:58 -08:00
651 changed files with 13884 additions and 1545 deletions
+30 -4
View File
@@ -8,6 +8,7 @@ var child_process = require("child_process");
// Variables
var compilerDirectory = "src/compiler/";
var servicesDirectory = "src/services/";
var serverDirectory = "src/server/";
var harnessDirectory = "src/harness/";
var libraryDirectory = "src/lib/";
var scriptsDirectory = "scripts/";
@@ -64,6 +65,7 @@ var servicesSources = [
return path.join(compilerDirectory, f);
}).concat([
"breakpoints.ts",
"navigateTo.ts",
"navigationBar.ts",
"outliningElementsCollector.ts",
"services.ts",
@@ -90,6 +92,16 @@ var servicesSources = [
return path.join(servicesDirectory, f);
}));
var serverSources = [
"node.d.ts",
"editorServices.ts",
"protocol.d.ts",
"session.ts",
"server.ts"
].map(function (f) {
return path.join(serverDirectory, f);
});
var definitionsRoots = [
"compiler/types.d.ts",
"compiler/scanner.d.ts",
@@ -130,6 +142,13 @@ var harnessSources = [
"services/preProcessFile.ts"
].map(function (f) {
return path.join(unittestsDirectory, f);
})).concat([
"protocol.d.ts",
"session.ts",
"client.ts",
"editorServices.ts",
].map(function (f) {
return path.join(serverDirectory, f);
}));
var librarySourceMap = [
@@ -327,6 +346,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/ [copyright],
/*useBuiltCompiler*/ true,
@@ -336,7 +356,10 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
/*preserveConstEnums*/ true,
/*keepComments*/ false,
/*noResolve*/ false,
/*stripInternal*/ false);
/*stripInternal*/ false,
/*callback*/ function () {
jake.cpR(servicesFile, nodePackageFile, {silent: true});
});
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
@@ -378,9 +401,12 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
jake.rmRf(tempDirPath, {silent: true});
});
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
// Local target to build the compiler and services
desc("Builds the full compiler and services");
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]);
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]);
// Local target to build only tsc.js
desc("Builds only the compiler");
@@ -435,7 +461,7 @@ task("generate-spec", [specMd])
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
desc("Makes a new LKG out of the built js files");
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
var expectedFiles = [tscFile, servicesFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
var missingFiles = expectedFiles.filter(function (f) {
return !fs.existsSync(f);
});
@@ -542,7 +568,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
}
if (tests && tests.toLocaleLowerCase() === "rwc") {
testTimeout = 50000;
testTimeout = 100000;
}
colors = process.env.colors || process.env.color
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./tsserver.js')
+3 -2
View File
@@ -25,9 +25,10 @@
"url": "https://github.com/Microsoft/TypeScript.git"
},
"preferGlobal": true,
"main": "./bin/typescriptServices.js",
"main": "./bin/typescript.js",
"bin": {
"tsc": "./bin/tsc"
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
},
"engines": {
"node": ">=0.8.0"
+8 -13
View File
@@ -51,17 +51,6 @@ module ts {
}
}
/**
* A declaration has a dynamic name if both of the following are true:
* 1. The declaration has a computed property name
* 2. The computed name is *not* expressed as Symbol.<name>, where name
* is a property of the Symbol constructor that denotes a built in
* Symbol.
*/
export function hasDynamicName(declaration: Declaration): boolean {
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
}
export function bindSourceFile(file: SourceFile): void {
var start = new Date().getTime();
bindSourceFileWorker(file);
@@ -98,13 +87,18 @@ module ts {
if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node;
}
// Should not be called on a declaration with a computed property name.
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node: Declaration): string {
if (node.name) {
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
return '"' + (<LiteralExpression>node.name).text + '"';
}
Debug.assert(!hasDynamicName(node));
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
var nameExpression = (<ComputedPropertyName>node.name).expression;
Debug.assert(isWellKnownSymbolSyntactically(nameExpression));
return getPropertyNameForKnownSymbolName((<PropertyAccessExpression>nameExpression).name.text);
}
return (<Identifier | LiteralExpression>node.name).text;
}
switch (node.kind) {
@@ -495,6 +489,7 @@ module ts {
case SyntaxKind.CatchClause:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.SwitchStatement:
bindChildren(node, 0, /*isBlockScopeContainer*/ true);
break;
+315 -97
View File
@@ -67,6 +67,7 @@ module ts {
var stringType = createIntrinsicType(TypeFlags.String, "string");
var numberType = createIntrinsicType(TypeFlags.Number, "number");
var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean");
var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol");
var voidType = createIntrinsicType(TypeFlags.Void, "void");
var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined");
var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null");
@@ -84,6 +85,7 @@ module ts {
var globals: SymbolTable = {};
var globalArraySymbol: Symbol;
var globalESSymbolConstructorSymbol: Symbol;
var globalObjectType: ObjectType;
var globalFunctionType: ObjectType;
@@ -93,6 +95,7 @@ module ts {
var globalBooleanType: ObjectType;
var globalRegExpType: ObjectType;
var globalTemplateStringsArrayType: ObjectType;
var globalESSymbolType: ObjectType;
var anyArrayType: Type;
@@ -120,6 +123,10 @@ module ts {
"boolean": {
type: booleanType,
flags: TypeFlags.Boolean
},
"symbol": {
type: esSymbolType,
flags: TypeFlags.ESSymbol
}
};
@@ -706,9 +713,15 @@ module ts {
return type;
}
// A reserved member name starts with two underscores followed by a non-underscore
// A reserved member name starts with two underscores, but the third character cannot be an underscore
// or the @ symbol. A third underscore indicates an escaped form of an identifer that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name: string) {
return name.charCodeAt(0) === CharacterCodes._ && name.charCodeAt(1) === CharacterCodes._ && name.charCodeAt(2) !== CharacterCodes._;
return name.charCodeAt(0) === CharacterCodes._ &&
name.charCodeAt(1) === CharacterCodes._ &&
name.charCodeAt(2) !== CharacterCodes._ &&
name.charCodeAt(2) !== CharacterCodes.at;
}
function getNamedMembers(members: SymbolTable): Symbol[] {
@@ -2489,9 +2502,9 @@ module ts {
return getPropertiesOfObjectType(getApparentType(type));
}
// For a type parameter, return the base constraint of the type parameter. For the string, number, and
// boolean primitive types, return the corresponding object types.Otherwise return the type itself.
// Note that the apparent type of a union type is the union type itself.
// For a type parameter, return the base constraint of the type parameter. For the string, number,
// boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
// type itself. Note that the apparent type of a union type is the union type itself.
function getApparentType(type: Type): Type {
if (type.flags & TypeFlags.TypeParameter) {
do {
@@ -2510,6 +2523,9 @@ module ts {
else if (type.flags & TypeFlags.Boolean) {
type = globalBooleanType;
}
else if (type.flags & TypeFlags.ESSymbol) {
type = globalESSymbolType;
}
return type;
}
@@ -2999,12 +3015,24 @@ module ts {
return <ObjectType>type;
}
function getGlobalSymbol(name: string): Symbol {
return resolveName(undefined, name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0, name);
function getGlobalValueSymbol(name: string): Symbol {
return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0);
}
function getGlobalTypeSymbol(name: string): Symbol {
return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0);
}
function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol {
return resolveName(undefined, name, meaning, diagnostic, name);
}
function getGlobalType(name: string): ObjectType {
return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0);
return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0);
}
function getGlobalESSymbolConstructorSymbol() {
return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"));
}
function createArrayType(elementType: Type): Type {
@@ -3174,6 +3202,8 @@ module ts {
return numberType;
case SyntaxKind.BooleanKeyword:
return booleanType;
case SyntaxKind.SymbolKeyword:
return esSymbolType;
case SyntaxKind.VoidKeyword:
return voidType;
case SyntaxKind.StringLiteral:
@@ -4612,6 +4642,7 @@ module ts {
case SyntaxKind.WhileStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.ReturnStatement:
case SyntaxKind.WithStatement:
case SyntaxKind.SwitchStatement:
@@ -4740,7 +4771,7 @@ module ts {
if (assumeTrue) {
// Assumed result is true. If check was not for a primitive type, remove all primitive types
if (!typeInfo) {
return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean, /*isOfTypeKind*/ true);
return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true);
}
// Check was for a primitive type, return that primitive type if it is a subtype
if (isTypeSubtypeOf(typeInfo.type, type)) {
@@ -5475,7 +5506,7 @@ module ts {
function isNumericComputedName(name: ComputedPropertyName): boolean {
// It seems odd to consider an expression of type Any to result in a numeric name,
// but this behavior is consistent with checkIndexedAccess
return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike);
return allConstituentTypesHaveKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike);
}
function isNumericLiteralName(name: string) {
@@ -5508,10 +5539,13 @@ module ts {
if (!links.resolvedType) {
links.resolvedType = checkExpression(node.expression);
// This will allow types number, string, or any. It will also allow enums, the unknown
// This will allow types number, string, symbol or any. It will also allow enums, the unknown
// type, and any union of these types (like string | number).
if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) {
error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any);
if (!allConstituentTypesHaveKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) {
error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true);
}
}
@@ -5760,8 +5794,8 @@ module ts {
// See if we can index as a property.
if (node.argumentExpression) {
if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) {
var name = (<LiteralExpression>node.argumentExpression).text;
var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType);
if (name !== undefined) {
var prop = getPropertyOfType(objectType, name);
if (prop) {
getNodeLinks(node).resolvedSymbol = prop;
@@ -5775,10 +5809,10 @@ module ts {
}
// Check for compatible indexer types.
if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) {
if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) {
// Try to use a number indexer.
if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) {
if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) {
var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number);
if (numberIndexType) {
return numberIndexType;
@@ -5800,11 +5834,78 @@ module ts {
}
// REVIEW: Users should know the type that was actually used.
error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any);
error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any);
return unknownType;
}
/**
* If indexArgumentExpression is a string literal or number literal, returns its text.
* If indexArgumentExpression is a well known symbol, returns the property name corresponding
* to this symbol, as long as it is a proper symbol reference.
* Otherwise, returns undefined.
*/
function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression, indexArgumentType: Type): string {
if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) {
return (<LiteralExpression>indexArgumentExpression).text;
}
if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) {
var rightHandSideName = (<Identifier>(<PropertyAccessExpression>indexArgumentExpression).name).text;
return getPropertyNameForKnownSymbolName(rightHandSideName);
}
return undefined;
}
/**
* A proper symbol reference requires the following:
* 1. The property access denotes a property that exists
* 2. The expression is of the form Symbol.<identifier>
* 3. The property access is of the primitive type symbol.
* 4. Symbol in this context resolves to the global Symbol object
*/
function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean {
if (expressionType === unknownType) {
// There is already an error, so no need to report one.
return false;
}
if (!isWellKnownSymbolSyntactically(expression)) {
return false;
}
// Make sure the property type is the primitive symbol type
if ((expressionType.flags & TypeFlags.ESSymbol) === 0) {
if (reportError) {
error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression));
}
return false;
}
// The name is Symbol.<someName>, so make sure Symbol actually resolves to the
// global Symbol object
var leftHandSide = <Identifier>(<PropertyAccessExpression>expression).expression;
var leftHandSideSymbol = getResolvedSymbol(leftHandSide);
if (!leftHandSideSymbol) {
return false;
}
var globalESSymbol = getGlobalESSymbolConstructorSymbol();
if (!globalESSymbol) {
// Already errored when we tried to look up the symbol
return false;
}
if (leftHandSideSymbol !== globalESSymbol) {
if (reportError) {
error(leftHandSide, Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object);
}
return false;
}
return true;
}
function resolveUntypedCall(node: CallLikeExpression): Signature {
if (node.kind === SyntaxKind.TaggedTemplateExpression) {
checkExpression((<TaggedTemplateExpression>node).template);
@@ -6719,7 +6820,7 @@ module ts {
}
function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean {
if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) {
if (!allConstituentTypesHaveKind(type, TypeFlags.Any | TypeFlags.NumberLike)) {
error(operand, diagnostic);
return false;
}
@@ -6835,6 +6936,9 @@ module ts {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) {
error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
}
return numberType;
case SyntaxKind.ExclamationToken:
return booleanType;
@@ -6870,8 +6974,26 @@ module ts {
return numberType;
}
// Return true if type has the given flags, or is a union type composed of types that all have those flags
function isTypeOfKind(type: Type, kind: TypeFlags): boolean {
// Just like isTypeOfKind below, except that it returns true if *any* constituent
// has this kind.
function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean {
if (type.flags & kind) {
return true;
}
if (type.flags & TypeFlags.Union) {
var types = (<UnionType>type).types;
for (var i = 0; i < types.length; i++) {
if (types[i].flags & kind) {
return true;
}
}
return false;
}
return false;
}
// Return true if type has the given flags, or is a union type composed of types that all have those flags.
function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean {
if (type.flags & kind) {
return true;
}
@@ -6901,7 +7023,7 @@ module ts {
// and the right operand to be of type Any or a subtype of the 'Function' interface type.
// The result is always of the Boolean primitive type.
// NOTE: do not raise error if leftType is unknown as related error was already reported
if (isTypeOfKind(leftType, TypeFlags.Primitive)) {
if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) {
error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
// NOTE: do not raise error if right is unknown as related error was already reported
@@ -6916,10 +7038,10 @@ module ts {
// The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,
// and the right operand to be of type Any, an object type, or a type parameter type.
// The result is always of the Boolean primitive type.
if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) {
error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number);
if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) {
error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -7080,19 +7202,26 @@ module ts {
if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType;
var resultType: Type;
if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) {
if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) {
// Operands of an enum type are treated as having the primitive type Number.
// If both operands are of the Number primitive type, the result is of the Number primitive type.
resultType = numberType;
}
else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) {
// If one or both operands are of the String primitive type, the result is of the String primitive type.
resultType = stringType;
}
else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) {
// Otherwise, the result is of type Any.
// NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we.
resultType = anyType;
else {
if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) {
// If one or both operands are of the String primitive type, the result is of the String primitive type.
resultType = stringType;
}
else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) {
// Otherwise, the result is of type Any.
// NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we.
resultType = anyType;
}
// Symbols are not allowed at all in arithmetic expressions
if (resultType && !checkForDisallowedESSymbolOperand(operator)) {
return resultType;
}
}
if (!resultType) {
@@ -7104,14 +7233,18 @@ module ts {
checkAssignmentOperator(resultType);
}
return resultType;
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
if (!checkForDisallowedESSymbolOperand(operator)) {
return booleanType;
}
// Fall through
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -7131,6 +7264,20 @@ module ts {
return rightType;
}
// Return type is true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
var offendingSymbolOperand =
someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left :
someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right :
undefined;
if (offendingSymbolOperand) {
error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator));
return false;
}
return true;
}
function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind {
switch (operator) {
case SyntaxKind.BarToken:
@@ -7216,7 +7363,10 @@ module ts {
}
function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type {
if (hasDynamicName(node)) {
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
checkComputedPropertyName(<ComputedPropertyName>node.name);
}
@@ -7227,7 +7377,10 @@ module ts {
// Grammar checking
checkGrammarMethod(node);
if (hasDynamicName(node)) {
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
checkComputedPropertyName(<ComputedPropertyName>node.name);
}
@@ -7490,7 +7643,7 @@ module ts {
function checkPropertyDeclaration(node: PropertyDeclaration) {
// Grammar checking
checkGrammarModifiers(node) || checkGrammarProperty(node);
checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);
checkVariableLikeDeclaration(node);
}
@@ -8039,12 +8192,16 @@ module ts {
function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void {
checkSignatureDeclaration(node);
if (hasDynamicName(node)) {
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(<ComputedPropertyName>node.name);
}
else {
if (!hasDynamicName(node)) {
// first we want to check the local symbol that contain this declaration
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode
@@ -8081,7 +8238,7 @@ module ts {
function checkBlock(node: Block) {
// Grammar checking for SyntaxKind.Block
if (node.kind === SyntaxKind.Block) {
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
}
forEach(node.statements, checkSourceElement);
@@ -8302,12 +8459,14 @@ module ts {
function checkVariableLikeDeclaration(node: VariableLikeDeclaration) {
checkSourceElement(node.type);
// For a computed property, just check the initializer and exit
if (hasDynamicName(node)) {
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
checkComputedPropertyName(<ComputedPropertyName>node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
return;
}
// For a binding pattern, check contained binding elements
if (isBindingPattern(node.name)) {
@@ -8395,14 +8554,14 @@ module ts {
function checkExpressionStatement(node: ExpressionStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node)
checkGrammarStatementInAmbientContext(node)
checkExpression(node.expression);
}
function checkIfStatement(node: IfStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
checkExpression(node.expression);
checkSourceElement(node.thenStatement);
@@ -8411,7 +8570,7 @@ module ts {
function checkDoStatement(node: DoStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
checkSourceElement(node.statement);
checkExpression(node.expression);
@@ -8419,7 +8578,7 @@ module ts {
function checkWhileStatement(node: WhileStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
checkExpression(node.expression);
checkSourceElement(node.statement);
@@ -8427,7 +8586,7 @@ module ts {
function checkForStatement(node: ForStatement) {
// Grammar checking
if (!checkGrammarForStatementInAmbientContext(node)) {
if (!checkGrammarStatementInAmbientContext(node)) {
if (node.initializer && node.initializer.kind == SyntaxKind.VariableDeclarationList) {
checkGrammarVariableDeclarationList(<VariableDeclarationList>node.initializer);
}
@@ -8447,18 +8606,14 @@ module ts {
checkSourceElement(node.statement);
}
function checkForOfStatement(node: ForOfStatement) {
// TODO: not yet implemented
checkGrammarForOfStatement(node);
}
function checkForInStatement(node: ForInStatement) {
// Grammar checking
if (!checkGrammarForStatementInAmbientContext(node)) {
if (node.initializer.kind === SyntaxKind.VariableDeclarationList) {
var variableList = <VariableDeclarationList>node.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
if (variableList.declarations.length > 1) {
grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement);
}
}
}
}
checkGrammarForInOrForOfStatement(node);
// TypeScript 1.0 spec (April 2014): 5.4
// In a 'for-in' statement of the form
@@ -8470,9 +8625,6 @@ module ts {
if (variableDeclarationList.declarations.length >= 1) {
var decl = variableDeclarationList.declarations[0];
checkVariableDeclaration(decl);
if (decl.type) {
error(decl, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation);
}
}
}
else {
@@ -8482,7 +8634,7 @@ module ts {
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = <Expression>node.initializer;
var exprType = checkExpression(varExpr);
if (exprType !== anyType && exprType !== stringType) {
if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) {
error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
@@ -8494,7 +8646,7 @@ module ts {
var exprType = checkExpression(node.expression);
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
// in this case error about missing name is already reported - do not report extra one
if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
@@ -8503,7 +8655,7 @@ module ts {
function checkBreakOrContinueStatement(node: BreakOrContinueStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);
checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node);
// TODO: Check that target label is valid
}
@@ -8514,7 +8666,7 @@ module ts {
function checkReturnStatement(node: ReturnStatement) {
// Grammar checking
if (!checkGrammarForStatementInAmbientContext(node)) {
if (!checkGrammarStatementInAmbientContext(node)) {
var functionBlock = getContainingFunction(node);
if (!functionBlock) {
grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);
@@ -8545,7 +8697,7 @@ module ts {
function checkWithStatement(node: WithStatement) {
// Grammar checking for withStatement
if (!checkGrammarForStatementInAmbientContext(node)) {
if (!checkGrammarStatementInAmbientContext(node)) {
if (node.parserContextFlags & ParserContextFlags.StrictMode) {
grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode);
}
@@ -8557,7 +8709,7 @@ module ts {
function checkSwitchStatement(node: SwitchStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
var firstDefaultClause: CaseOrDefaultClause;
var hasDuplicateDefaultClause = false;
@@ -8594,7 +8746,7 @@ module ts {
function checkLabeledStatement(node: LabeledStatement) {
// Grammar checking
if (!checkGrammarForStatementInAmbientContext(node)) {
if (!checkGrammarStatementInAmbientContext(node)) {
var current = node.parent;
while (current) {
if (isAnyFunction(current)) {
@@ -8615,7 +8767,7 @@ module ts {
function checkThrowStatement(node: ThrowStatement) {
// Grammar checking
if (!checkGrammarForStatementInAmbientContext(node)) {
if (!checkGrammarStatementInAmbientContext(node)) {
if (node.expression === undefined) {
grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here);
}
@@ -8628,7 +8780,7 @@ module ts {
function checkTryStatement(node: TryStatement) {
// Grammar checking
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
checkBlock(node.tryBlock);
var catchClause = node.catchClause;
@@ -8745,6 +8897,7 @@ module ts {
case "number":
case "boolean":
case "string":
case "symbol":
case "void":
error(name, message, (<Identifier>name).text);
}
@@ -8963,7 +9116,7 @@ module ts {
var typeName1 = typeToString(existing.containingType);
var typeName2 = typeToString(base);
var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2);
var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2);
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);
diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));
}
@@ -9450,6 +9603,8 @@ module ts {
return checkForStatement(<ForStatement>node);
case SyntaxKind.ForInStatement:
return checkForInStatement(<ForInStatement>node);
case SyntaxKind.ForOfStatement:
return checkForOfStatement(<ForOfStatement>node);
case SyntaxKind.ContinueStatement:
case SyntaxKind.BreakStatement:
return checkBreakOrContinueStatement(<BreakOrContinueStatement>node);
@@ -9484,10 +9639,10 @@ module ts {
case SyntaxKind.ExportAssignment:
return checkExportAssignment(<ExportAssignment>node);
case SyntaxKind.EmptyStatement:
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
return;
case SyntaxKind.DebuggerStatement:
checkGrammarForStatementInAmbientContext(node);
checkGrammarStatementInAmbientContext(node);
return;
}
}
@@ -9559,6 +9714,7 @@ module ts {
case SyntaxKind.WhileStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.ContinueStatement:
case SyntaxKind.BreakStatement:
case SyntaxKind.ReturnStatement:
@@ -9755,6 +9911,7 @@ module ts {
case SyntaxKind.NumberKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
return true;
case SyntaxKind.VoidKeyword:
return node.parent.kind !== SyntaxKind.VoidExpression;
@@ -10279,7 +10436,7 @@ module ts {
getSymbolLinks(unknownSymbol).type = unknownType;
globals[undefinedSymbol.name] = undefinedSymbol;
// Initialize special types
globalArraySymbol = getGlobalSymbol("Array");
globalArraySymbol = getGlobalTypeSymbol("Array");
globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1);
globalObjectType = getGlobalType("Object");
globalFunctionType = getGlobalType("Function");
@@ -10287,11 +10444,24 @@ module ts {
globalNumberType = getGlobalType("Number");
globalBooleanType = getGlobalType("Boolean");
globalRegExpType = getGlobalType("RegExp");
// If we're in ES6 mode, load the TemplateStringsArray.
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6
? getGlobalType("TemplateStringsArray")
: unknownType;
if (languageVersion >= ScriptTarget.ES6) {
globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray");
globalESSymbolType = getGlobalType("Symbol");
globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol");
}
else {
globalTemplateStringsArrayType = unknownType;
// Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it
// extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have
// a global Symbol already, particularly if it is a class.
globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
globalESSymbolConstructorSymbol = undefined;
}
anyArrayType = createArrayType(anyType);
}
@@ -10506,25 +10676,25 @@ module ts {
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
}
}
else if (parameter.dotDotDotToken) {
if (parameter.dotDotDotToken) {
return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
}
else if (parameter.flags & NodeFlags.Modifier) {
if (parameter.flags & NodeFlags.Modifier) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);
}
else if (parameter.questionToken) {
if (parameter.questionToken) {
return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
}
else if (parameter.initializer) {
if (parameter.initializer) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
}
else if (!parameter.type) {
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) {
if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
}
else if (!node.type) {
if (!node.type) {
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation);
}
}
@@ -10755,6 +10925,49 @@ module ts {
}
}
function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInStatement | ForOfStatement): boolean {
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
var variableList = <VariableDeclarationList>forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
if (variableList.declarations.length > 1) {
var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement
? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = variableList.declarations[0];
if (firstDeclaration.initializer) {
var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement
? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement
? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
}
}
}
return false;
}
function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean {
// Temporarily disallow for-of statements until type check work is complete.
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported);
if (languageVersion < ScriptTarget.ES6) {
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
}
return checkGrammarForInOrForOfStatement(forOfStatement);
}
function checkGrammarAccessor(accessor: MethodDeclaration): boolean {
var kind = accessor.kind;
if (languageVersion < ScriptTarget.ES5) {
@@ -10797,8 +11010,8 @@ module ts {
}
}
function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) {
if (node.kind === SyntaxKind.ComputedPropertyName) {
function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) {
if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((<ComputedPropertyName>node).expression)) {
return grammarErrorOnNode(node, message);
}
}
@@ -10829,17 +11042,17 @@ module ts {
// and accessors are not allowed in ambient contexts in general,
// so this error only really matters for methods.
if (isInAmbientContext(node)) {
return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context);
return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol);
}
else if (!node.body) {
return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads);
return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);
}
}
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) {
return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces);
return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);
}
else if (node.parent.kind === SyntaxKind.TypeLiteral) {
return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals);
return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);
}
}
@@ -10847,6 +11060,7 @@ module ts {
switch (node.kind) {
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
return true;
@@ -11003,6 +11217,7 @@ module ts {
case SyntaxKind.WithStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
return false;
case SyntaxKind.LabeledStatement:
return allowLetAndConstDeclarations(parent.parent);
@@ -11053,6 +11268,9 @@ module ts {
var inAmbientContext = isInAmbientContext(enumDecl);
for (var i = 0, n = enumDecl.members.length; i < n; i++) {
var node = enumDecl.members[i];
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
}
@@ -11133,17 +11351,17 @@ module ts {
function checkGrammarProperty(node: PropertyDeclaration) {
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) ||
checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) {
checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
}
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) {
if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) {
if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
}
else if (node.parent.kind === SyntaxKind.TypeLiteral) {
if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) {
if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
}
@@ -11190,7 +11408,7 @@ module ts {
return isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
}
function checkGrammarForStatementInAmbientContext(node: Node): boolean {
function checkGrammarStatementInAmbientContext(node: Node): boolean {
if (isInAmbientContext(node)) {
// An accessors is already reported about the ambient context
if (isAccessor(node.parent.kind)) {
@@ -123,12 +123,12 @@ module ts {
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." },
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." },
A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." },
A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." },
A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." },
A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." },
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." },
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." },
@@ -147,6 +147,9 @@ module ts {
Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." },
A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." },
Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." },
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -166,7 +169,7 @@ module ts {
Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." },
Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." },
Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." },
Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." },
Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." },
@@ -188,7 +191,7 @@ module ts {
Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." },
Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" },
Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." },
An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." },
An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." },
Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." },
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." },
@@ -204,7 +207,7 @@ module ts {
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." },
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." },
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." },
The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." },
The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." },
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" },
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
@@ -299,20 +302,26 @@ module ts {
Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." },
A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" },
A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." },
A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." },
A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." },
this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." },
super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." },
A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." },
Enum_declarations_must_all_be_const_or_non_const: { code: 2469, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2470, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2471, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2472, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." },
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2473, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." },
const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2474, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },
Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." },
The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." },
Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." },
A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." },
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." },
Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." },
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." },
const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." },
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: 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: 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: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -458,5 +467,6 @@ module ts {
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." },
};
}
+61 -21
View File
@@ -483,11 +483,11 @@
"category": "Error",
"code": 1164
},
"Computed property names are not allowed in an ambient context.": {
"A computed property name in an ambient context must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1165
},
"Computed property names are not allowed in class property declarations.": {
"A computed property name in a class property declaration must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1166
},
@@ -495,15 +495,15 @@
"category": "Error",
"code": 1167
},
"Computed property names are not allowed in method overloads.": {
"A computed property name in a method overload must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1168
},
"Computed property names are not allowed in interfaces.": {
"A computed property name in an interface must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1169
},
"Computed property names are not allowed in type literals.": {
"A computed property name in a type literal must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1170
},
@@ -579,6 +579,18 @@
"category": "Error",
"code": 1187
},
"Only a single variable declaration is allowed in a 'for...of' statement.": {
"category": "Error",
"code": 1188
},
"The variable declaration of a 'for...in' statement cannot have an initializer.": {
"category": "Error",
"code": 1189
},
"The variable declaration of a 'for...of' statement cannot have an initializer.": {
"category": "Error",
"code": 1190
},
"Duplicate identifier '{0}'.": {
"category": "Error",
@@ -656,7 +668,7 @@
"category": "Error",
"code": 2318
},
"Named properties '{0}' of types '{1}' and '{2}' are not identical.": {
"Named property '{0}' of types '{1}' and '{2}' are not identical.": {
"category": "Error",
"code": 2319
},
@@ -744,7 +756,7 @@
"category": "Error",
"code": 2341
},
"An index expression argument must be of type 'string', 'number', or 'any'.": {
"An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": {
"category": "Error",
"code": 2342
},
@@ -808,7 +820,7 @@
"category": "Error",
"code": 2359
},
"The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": {
"The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": {
"category": "Error",
"code": 2360
},
@@ -1188,7 +1200,7 @@
"category": "Error",
"code": 2463
},
"A computed property name must be of type 'string', 'number', or 'any'.": {
"A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": {
"category": "Error",
"code": 2464
},
@@ -1202,48 +1214,72 @@
},
"A computed property name cannot reference a type parameter from its containing type.": {
"category": "Error",
"code": 2466
"code": 2467
},
"Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": {
"Cannot find global value '{0}'.": {
"category": "Error",
"code": 2468
},
"Enum declarations must all be const or non-const.": {
"The '{0}' operator cannot be applied to type 'symbol'.": {
"category": "Error",
"code": 2469
},
"In 'const' enum declarations member initializer must be constant expression.": {
"'Symbol' reference does not refer to the global Symbol constructor object.": {
"category": "Error",
"code": 2470
},
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
"A computed property name of the form '{0}' must be of type 'symbol'.": {
"category": "Error",
"code": 2471
},
"A const enum member can only be accessed using a string literal.": {
"Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 2472
},
"'const' enum member initializer was evaluated to a non-finite value.": {
"Enum declarations must all be const or non-const.": {
"category": "Error",
"code": 2473
},
"'const' enum member initializer was evaluated to disallowed value 'NaN'.": {
"In 'const' enum declarations member initializer must be constant expression.": {
"category": "Error",
"code": 2474
},
"Property '{0}' does not exist on 'const' enum '{1}'.": {
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
"category": "Error",
"code": 2475
},
"'let' is not allowed to be used as a name in 'let' or 'const' declarations.": {
"A const enum member can only be accessed using a string literal.": {
"category": "Error",
"code": 2476
},
"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": {
"'const' enum member initializer was evaluated to a non-finite value.": {
"category": "Error",
"code": 2477
},
"'const' enum member initializer was evaluated to disallowed value 'NaN'.": {
"category": "Error",
"code": 2478
},
"Property '{0}' does not exist on 'const' enum '{1}'.": {
"category": "Error",
"code": 2479
},
"'let' is not allowed to be used as a name in 'let' or 'const' declarations.": {
"category": "Error",
"code": 2480
},
"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": {
"category": "Error",
"code": 2481
},
"'for...of' statements are only available when targeting ECMAScript 6 or higher.": {
"category": "Error",
"code": 2482
},
"The left-hand side of a 'for...of' statement cannot use a type annotation.": {
"category": "Error",
"code": 2483
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -1520,7 +1556,7 @@
"Exported type alias '{0}' has or is using private name '{1}'.": {
"category": "Error",
"code": 4081
},
},
"The current host does not support the '{0}' option.": {
"category": "Error",
"code": 5001
@@ -1825,5 +1861,9 @@
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
"category": "Error",
"code": 9002
},
"'for...of' statements are not currently supported.": {
"category": "Error",
"code": 9003
}
}
+26 -15
View File
@@ -276,7 +276,7 @@ module ts {
var firstAccessor: AccessorDeclaration;
var getAccessor: AccessorDeclaration;
var setAccessor: AccessorDeclaration;
if (accessor.name.kind === SyntaxKind.ComputedPropertyName) {
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
if (accessor.kind === SyntaxKind.GetAccessor) {
getAccessor = accessor;
@@ -290,19 +290,22 @@ module ts {
}
else {
forEach(node.members,(member: Declaration) => {
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) &&
(<Identifier>member.name).text === (<Identifier>accessor.name).text &&
(member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
if (!firstAccessor) {
firstAccessor = <AccessorDeclaration>member;
}
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor)
&& (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
var memberName = getPropertyNameForPropertyNameNode(member.name);
var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
if (memberName === accessorName) {
if (!firstAccessor) {
firstAccessor = <AccessorDeclaration>member;
}
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
getAccessor = <AccessorDeclaration>member;
}
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
getAccessor = <AccessorDeclaration>member;
}
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
setAccessor = <AccessorDeclaration>member;
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
setAccessor = <AccessorDeclaration>member;
}
}
}
});
@@ -580,6 +583,7 @@ module ts {
case SyntaxKind.StringKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.StringLiteral:
return writeTextOfNode(currentSourceFile, type);
@@ -2917,7 +2921,7 @@ module ts {
emitEmbeddedStatement(node.statement);
}
function emitForInStatement(node: ForInStatement) {
function emitForInOrForOfStatement(node: ForInStatement | ForOfStatement) {
var endPos = emitToken(SyntaxKind.ForKeyword, node.pos);
write(" ");
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
@@ -2938,7 +2942,13 @@ module ts {
else {
emit(node.initializer);
}
write(" in ");
if (node.kind === SyntaxKind.ForInStatement) {
write(" in ");
}
else {
write(" of ");
}
emit(node.expression);
emitToken(SyntaxKind.CloseParenToken, node.expression.end);
emitEmbeddedStatement(node.statement);
@@ -4357,8 +4367,9 @@ module ts {
return emitWhileStatement(<WhileStatement>node);
case SyntaxKind.ForStatement:
return emitForStatement(<ForStatement>node);
case SyntaxKind.ForOfStatement:
case SyntaxKind.ForInStatement:
return emitForInStatement(<ForInStatement>node);
return emitForInOrForOfStatement(<ForInStatement>node);
case SyntaxKind.ContinueStatement:
case SyntaxKind.BreakStatement:
return emitBreakOrContinueStatement(<BreakOrContinueStatement>node);
+56 -18
View File
@@ -191,6 +191,10 @@ module ts {
return visitNode(cbNode, (<ForInStatement>node).initializer) ||
visitNode(cbNode, (<ForInStatement>node).expression) ||
visitNode(cbNode, (<ForInStatement>node).statement);
case SyntaxKind.ForOfStatement:
return visitNode(cbNode, (<ForOfStatement>node).initializer) ||
visitNode(cbNode, (<ForOfStatement>node).expression) ||
visitNode(cbNode, (<ForOfStatement>node).statement);
case SyntaxKind.ContinueStatement:
case SyntaxKind.BreakStatement:
return visitNode(cbNode, (<BreakOrContinueStatement>node).label);
@@ -1598,8 +1602,8 @@ module ts {
}
// in the case where we're parsing the variable declarator of a 'for-in' statement, we
// are done if we see an 'in' keyword in front of us.
if (token === SyntaxKind.InKeyword) {
// are done if we see an 'in' keyword in front of us. Same with for-of
if (isInOrOfKeyword(token)) {
return true;
}
@@ -1877,6 +1881,7 @@ module ts {
case SyntaxKind.BreakStatement:
case SyntaxKind.ContinueStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.WithStatement:
@@ -2593,6 +2598,7 @@ module ts {
case SyntaxKind.StringKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
var node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReference();
@@ -2617,6 +2623,7 @@ module ts {
case SyntaxKind.StringKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
case SyntaxKind.TypeOfKeyword:
case SyntaxKind.OpenBraceToken:
@@ -3159,6 +3166,10 @@ module ts {
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t: SyntaxKind) {
return t === SyntaxKind.InKeyword || t === SyntaxKind.OfKeyword;
}
function parseBinaryExpressionRest(precedence: number, leftOperand: Expression): Expression {
while (true) {
// We either have a binary operator here, or we're finished. We call
@@ -3788,7 +3799,7 @@ module ts {
return finishNode(node);
}
function parseForOrForInStatement(): Statement {
function parseForOrForInOrForOfStatement(): Statement {
var pos = getNodePos();
parseExpected(SyntaxKind.ForKeyword);
parseExpected(SyntaxKind.OpenParenToken);
@@ -3796,21 +3807,27 @@ module ts {
var initializer: VariableDeclarationList | Expression = undefined;
if (token !== SyntaxKind.SemicolonToken) {
if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) {
initializer = parseVariableDeclarationList(/*disallowIn:*/ true);
initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true);
}
else {
initializer = disallowInAnd(parseExpression);
}
}
var forOrForInStatement: IterationStatement;
var forOrForInOrForOfStatement: IterationStatement;
if (parseOptional(SyntaxKind.InKeyword)) {
var forInStatement = <ForInStatement>createNode(SyntaxKind.ForInStatement, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(SyntaxKind.CloseParenToken);
forOrForInStatement = forInStatement;
forOrForInOrForOfStatement = forInStatement;
}
else {
else if (parseOptional(SyntaxKind.OfKeyword)) {
var forOfStatement = <ForOfStatement>createNode(SyntaxKind.ForOfStatement, pos);
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(SyntaxKind.CloseParenToken);
forOrForInOrForOfStatement = forOfStatement;
} else {
var forStatement = <ForStatement>createNode(SyntaxKind.ForStatement, pos);
forStatement.initializer = initializer;
parseExpected(SyntaxKind.SemicolonToken);
@@ -3822,12 +3839,12 @@ module ts {
forStatement.iterator = allowInAnd(parseExpression);
}
parseExpected(SyntaxKind.CloseParenToken);
forOrForInStatement = forStatement;
forOrForInOrForOfStatement = forStatement;
}
forOrForInStatement.statement = parseStatement();
forOrForInOrForOfStatement.statement = parseStatement();
return finishNode(forOrForInStatement);
return finishNode(forOrForInOrForOfStatement);
}
function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement {
@@ -4073,7 +4090,7 @@ module ts {
case SyntaxKind.WhileKeyword:
return parseWhileStatement();
case SyntaxKind.ForKeyword:
return parseForOrForInStatement();
return parseForOrForInOrForOfStatement();
case SyntaxKind.ContinueKeyword:
return parseBreakOrContinueStatement(SyntaxKind.ContinueStatement);
case SyntaxKind.BreakKeyword:
@@ -4215,11 +4232,13 @@ module ts {
var node = <VariableDeclaration>createNode(SyntaxKind.VariableDeclaration);
node.name = parseIdentifierOrPattern();
node.type = parseTypeAnnotation();
node.initializer = parseInitializer(/*inParameter*/ false);
if (!isInOrOfKeyword(token)) {
node.initializer = parseInitializer(/*inParameter*/ false);
}
return finishNode(node);
}
function parseVariableDeclarationList(disallowIn: boolean): VariableDeclarationList {
function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList {
var node = <VariableDeclarationList>createNode(SyntaxKind.VariableDeclarationList);
switch (token) {
@@ -4236,20 +4255,39 @@ module ts {
}
nextToken();
var savedDisallowIn = inDisallowInContext();
setDisallowInContext(disallowIn);
node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration);
// The user may have written the following:
//
// for (var of X) { }
//
// In this case, we want to parse an empty declaration list, and then parse 'of'
// as a keyword. The reason this is not automatic is that 'of' is a valid identifier.
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
if (token === SyntaxKind.OfKeyword && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList<VariableDeclaration>();
}
else {
var savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
setDisallowInContext(savedDisallowIn);
node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration);
setDisallowInContext(savedDisallowIn);
}
return finishNode(node);
}
function canFollowContextualOfKeyword(): boolean {
return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken;
}
function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement {
var node = <VariableStatement>createNode(SyntaxKind.VariableStatement, fullStart);
setModifiers(node, modifiers);
node.declarationList = parseVariableDeclarationList(/*disallowIn:*/ false);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false);
parseSemicolon();
return finishNode(node);
}
+2
View File
@@ -82,6 +82,7 @@ module ts {
"string": SyntaxKind.StringKeyword,
"super": SyntaxKind.SuperKeyword,
"switch": SyntaxKind.SwitchKeyword,
"symbol": SyntaxKind.SymbolKeyword,
"this": SyntaxKind.ThisKeyword,
"throw": SyntaxKind.ThrowKeyword,
"true": SyntaxKind.TrueKeyword,
@@ -93,6 +94,7 @@ module ts {
"while": SyntaxKind.WhileKeyword,
"with": SyntaxKind.WithKeyword,
"yield": SyntaxKind.YieldKeyword,
"of": SyntaxKind.OfKeyword,
"{": SyntaxKind.OpenBraceToken,
"}": SyntaxKind.CloseBraceToken,
"(": SyntaxKind.OpenParenToken,
+13 -5
View File
@@ -140,8 +140,9 @@ module ts {
NumberKeyword,
SetKeyword,
StringKeyword,
SymbolKeyword,
TypeKeyword,
OfKeyword, // LastKeyword and LastToken
// Parse tree nodes
// Names
@@ -210,6 +211,7 @@ module ts {
WhileStatement,
ForStatement,
ForInStatement,
ForOfStatement,
ContinueStatement,
BreakStatement,
ReturnStatement,
@@ -259,7 +261,7 @@ module ts {
FirstReservedWord = BreakKeyword,
LastReservedWord = WithKeyword,
FirstKeyword = BreakKeyword,
LastKeyword = TypeKeyword,
LastKeyword = OfKeyword,
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypeReference,
@@ -267,7 +269,7 @@ module ts {
FirstPunctuation = OpenBraceToken,
LastPunctuation = CaretEqualsToken,
FirstToken = Unknown,
LastToken = TypeKeyword,
LastToken = OfKeyword,
FirstTriviaToken = SingleLineCommentTrivia,
LastTriviaToken = ConflictMarkerTrivia,
FirstLiteralToken = NumericLiteral,
@@ -752,6 +754,11 @@ module ts {
expression: Expression;
}
export interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
export interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -1298,9 +1305,10 @@ module ts {
ObjectLiteral = 0x00020000, // Originates in an object literal
ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6
Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null,
Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum,
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum,
StringLike = String | StringLiteral,
NumberLike = Number | Enum,
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
+52 -1
View File
@@ -348,6 +348,7 @@ module ts {
case SyntaxKind.WhileStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.WithStatement:
case SyntaxKind.SwitchStatement:
case SyntaxKind.CaseClause:
@@ -565,7 +566,8 @@ module ts {
forStatement.condition === node ||
forStatement.iterator === node;
case SyntaxKind.ForInStatement:
var forInStatement = <ForInStatement>parent;
case SyntaxKind.ForOfStatement:
var forInStatement = <ForInStatement | ForOfStatement>parent;
return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) ||
forInStatement.expression === node;
case SyntaxKind.TypeAssertionExpression:
@@ -693,6 +695,7 @@ module ts {
case SyntaxKind.ExpressionStatement:
case SyntaxKind.EmptyStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.IfStatement:
case SyntaxKind.LabeledStatement:
@@ -840,6 +843,54 @@ module ts {
return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken;
}
/**
* A declaration has a dynamic name if both of the following are true:
* 1. The declaration has a computed property name
* 2. The computed name is *not* expressed as Symbol.<name>, where name
* is a property of the Symbol constructor that denotes a built in
* Symbol.
*/
export function hasDynamicName(declaration: Declaration): boolean {
return declaration.name &&
declaration.name.kind === SyntaxKind.ComputedPropertyName &&
!isWellKnownSymbolSyntactically((<ComputedPropertyName>declaration.name).expression);
}
/**
* Checks if the expression is of the form:
* Symbol.name
* where Symbol is literally the word "Symbol", and name is any identifierName
*/
export function isWellKnownSymbolSyntactically(node: Expression): boolean {
return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((<PropertyAccessExpression>node).expression);
}
export function getPropertyNameForPropertyNameNode(name: DeclarationName): string {
if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) {
return (<Identifier | LiteralExpression>name).text;
}
if (name.kind === SyntaxKind.ComputedPropertyName) {
var nameExpression = (<ComputedPropertyName>name).expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
var rightHandSideName = (<PropertyAccessExpression>nameExpression).name.text;
return getPropertyNameForKnownSymbolName(rightHandSideName);
}
}
return undefined;
}
export function getPropertyNameForKnownSymbolName(symbolName: string): string {
return "__@" + symbolName;
}
/**
* Includes the word "Symbol" with unicode escapes
*/
export function isESSymbolIdentifier(node: Node): boolean {
return node.kind === SyntaxKind.Identifier && (<Identifier>node).text === "Symbol";
}
export function isModifier(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.PublicKeyword:
+6 -1
View File
@@ -282,6 +282,8 @@ module FourSlash {
return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions);
case FourSlashTestType.Shims:
return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions);
case FourSlashTestType.Server:
return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions);
default:
throw new Error("Unknown FourSlash test type: ");
}
@@ -418,6 +420,9 @@ module FourSlash {
this.activeFile = fileToOpen;
var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1);
this.scenarioActions.push('<OpenFile FileName="" SrcFileId="' + fileName + '" FileId="' + fileName + '" />');
// Let the host know that this file is now open
this.languageServiceAdapterHost.openFile(fileToOpen.fileName);
}
public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) {
@@ -1927,7 +1932,7 @@ module FourSlash {
}
var missingItem = { name: name, kind: kind };
this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items, null, " ") + ')');
}
private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) {
+6 -1
View File
@@ -4,7 +4,8 @@
const enum FourSlashTestType {
Native,
Shims
Shims,
Server
}
class FourSlashRunner extends RunnerBase {
@@ -22,6 +23,10 @@ class FourSlashRunner extends RunnerBase {
this.basePath = 'tests/cases/fourslash/shims';
this.testSuiteName = 'fourslash-shims';
break;
case FourSlashTestType.Server:
this.basePath = 'tests/cases/fourslash/server';
this.testSuiteName = 'fourslash-server';
break;
}
}
+4 -3
View File
@@ -16,14 +16,15 @@
/// <reference path='..\services\services.ts' />
/// <reference path='..\services\shims.ts' />
/// <reference path='..\server\session.ts' />
/// <reference path='..\server\client.ts' />
/// <reference path='..\server\node.d.ts' />
/// <reference path='external\mocha.d.ts'/>
/// <reference path='external\chai.d.ts'/>
/// <reference path='sourceMapRecorder.ts'/>
/// <reference path='runnerbase.ts'/>
declare var require: any;
declare var process: any;
var Buffer = require('buffer').Buffer;
var Buffer: BufferConstructor = require('buffer').Buffer;
// this will work in the browser via browserify
var _chai: typeof chai = require('chai');
+162 -18
View File
@@ -1,5 +1,6 @@
/// <reference path='..\services\services.ts' />
/// <reference path='..\services\shims.ts' />
/// <reference path='..\server\client.ts' />
/// <reference path='harness.ts' />
module Harness.LanguageService {
@@ -23,18 +24,18 @@ module Harness.LanguageService {
this.version++;
}
public editContent(minChar: number, limChar: number, newText: string): void {
public editContent(start: number, end: number, newText: string): void {
// Apply edits
var prefix = this.content.substring(0, minChar);
var prefix = this.content.substring(0, start);
var middle = newText;
var suffix = this.content.substring(limChar);
var suffix = this.content.substring(end);
this.setContent(prefix + middle + suffix);
// Store edit range + new length of script
this.editRanges.push({
length: this.content.length,
textChangeRange: ts.createTextChangeRange(
ts.createTextSpanFromBounds(minChar, limChar), newText.length)
ts.createTextSpanFromBounds(start, end), newText.length)
});
// Update version #
@@ -145,26 +146,19 @@ module Harness.LanguageService {
this.fileNameToScript[fileName] = new ScriptInfo(fileName, content);
}
public updateScript(fileName: string, content: string) {
public editScript(fileName: string, start: number, end: number, newText: string) {
var script = this.getScriptInfo(fileName);
if (script !== null) {
script.updateContent(content);
return;
}
this.addScript(fileName, content);
}
public editScript(fileName: string, minChar: number, limChar: number, newText: string) {
var script = this.getScriptInfo(fileName);
if (script !== null) {
script.editContent(minChar, limChar, newText);
script.editContent(start, end, newText);
return;
}
throw new Error("No script with name '" + fileName + "'");
}
public openFile(fileName: string): void {
}
/**
* @param line 0 based index
* @param col 0 based index
@@ -219,8 +213,7 @@ module Harness.LanguageService {
getFilenames(): string[] { return this.nativeHost.getFilenames(); }
getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); }
addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); }
updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); }
editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); }
editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); }
positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); }
getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); }
@@ -424,5 +417,156 @@ module Harness.LanguageService {
return convertResult;
}
}
// Server adapter
class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost {
private client: ts.server.SessionClient;
constructor(cancellationToken: ts.CancellationToken, settings: ts.CompilerOptions) {
super(cancellationToken, settings);
}
onMessage(message: string): void {
}
writeMessage(message: string): void {
}
setClient(client: ts.server.SessionClient) {
this.client = client;
}
openFile(fileName: string): void {
super.openFile(fileName);
this.client.openFile(fileName);
}
editScript(fileName: string, start: number, end: number, newText: string) {
super.editScript(fileName, start, end, newText);
this.client.changeFile(fileName, start, end, newText);
}
}
class SessionServerHost implements ts.server.ServerHost, ts.server.Logger {
args: string[] = [];
newLine: string;
useCaseSensitiveFileNames: boolean = false;
constructor(private host: NativeLanguageServiceHost) {
this.newLine = this.host.getNewLine();
}
onMessage(message: string): void {
}
writeMessage(message: string): void {
}
write(message: string): void {
this.writeMessage(message);
}
readFile(fileName: string): string {
if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) {
fileName = Harness.Compiler.defaultLibFileName;
}
var snapshot = this.host.getScriptSnapshot(fileName);
return snapshot && snapshot.getText(0, snapshot.getLength());
}
writeFile(name: string, text: string, writeByteOrderMark: boolean): void {
}
resolvePath(path: string): string {
return path;
}
fileExists(path: string): boolean {
return !!this.host.getScriptSnapshot(path);
}
directoryExists(path: string): boolean {
return false;
}
getExecutingFilePath(): string {
return "";
}
exit(exitCode: number): void {
}
createDirectory(directoryName: string): void {
throw new Error("Not Implemented Yet.");
}
getCurrentDirectory(): string {
return this.host.getCurrentDirectory();
}
readDirectory(path: string, extension?: string): string[] {
throw new Error("Not implemented Yet.");
}
watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
return { close() { } };
}
close(): void {
}
info(message: string): void {
return this.host.log(message);
}
msg(message: string) {
return this.host.log(message);
}
endGroup(): void {
}
perftrc(message: string): void {
return this.host.log(message);
}
startGroup(): void {
}
}
export class ServerLanugageServiceAdapter implements LanguageServiceAdapter {
private host: SessionClientHost;
private client: ts.server.SessionClient;
constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) {
// This is the main host that tests use to direct tests
var clientHost = new SessionClientHost(cancellationToken, options);
var client = new ts.server.SessionClient(clientHost);
// This host is just a proxy for the clientHost, it uses the client
// host to answer server queries about files on disk
var serverHost = new SessionServerHost(clientHost);
var server = new ts.server.Session(serverHost, serverHost);
// Fake the connection between the client and the server
serverHost.writeMessage = client.onMessage.bind(client);
clientHost.writeMessage = server.onMessage.bind(server);
// Wire the client to the host to get notifications when a file is open
// or edited.
clientHost.setClient(client);
// Set the properties
this.client = client;
this.host = clientHost;
}
getHost() { return this.host; }
getLanguageService(): ts.LanguageService { return this.client; }
getClassifier(): ts.Classifier { throw new Error("getClassifier is not available using the server interface."); }
getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); }
}
}
+4
View File
@@ -66,6 +66,9 @@ if (testConfigFile !== '') {
case 'fourslash-shims':
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
break;
case 'fourslash-server':
runners.push(new FourSlashRunner(FourSlashTestType.Server));
break;
case 'fourslash-generated':
runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native));
break;
@@ -95,6 +98,7 @@ if (runners.length === 0) {
// language services
runners.push(new FourSlashRunner(FourSlashTestType.Native));
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
runners.push(new FourSlashRunner(FourSlashTestType.Server));
//runners.push(new GeneratedFourslashRunner());
}
+39 -39
View File
@@ -1,4 +1,4 @@
declare type PropertyKey = string | number | Symbol;
declare type PropertyKey = string | number | symbol;
interface Symbol {
/** Returns a string representation of an object. */
@@ -7,7 +7,7 @@ interface Symbol {
/** Returns the primitive value of the specified object. */
valueOf(): Object;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface SymbolConstructor {
@@ -20,21 +20,21 @@ interface SymbolConstructor {
* Returns a new unique Symbol value.
* @param description Description of the new Symbol object.
*/
(description?: string|number): Symbol;
(description?: string|number): symbol;
/**
* Returns a Symbol object from the global symbol registry matching the given key if found.
* Otherwise, returns a new symbol with this key.
* @param key key to search for.
*/
for(key: string): Symbol;
for(key: string): symbol;
/**
* Returns a key from the global symbol registry matching the given Symbol if found.
* Otherwise, returns a undefined.
* @param sym Symbol to find the key for.
*/
keyFor(sym: Symbol): string;
keyFor(sym: symbol): string;
// Well-known Symbols
@@ -42,42 +42,42 @@ interface SymbolConstructor {
* A method that determines if a constructor object recognizes an object as one of the
* constructors instances. Called by the semantics of the instanceof operator.
*/
hasInstance: Symbol;
hasInstance: symbol;
/**
* A Boolean value that if true indicates that an object should flatten to its array elements
* by Array.prototype.concat.
*/
isConcatSpreadable: Symbol;
isConcatSpreadable: symbol;
/**
* A Boolean value that if true indicates that an object may be used as a regular expression.
*/
isRegExp: Symbol;
isRegExp: symbol;
/**
* A method that returns the default iterator for an object.Called by the semantics of the
* for-of statement.
*/
iterator: Symbol;
iterator: symbol;
/**
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
* abstract operation.
*/
toPrimitive: Symbol;
toPrimitive: symbol;
/**
* A String value that is used in the creation of the default string description of an object.
* Called by the built- in method Object.prototype.toString.
*/
toStringTag: Symbol;
toStringTag: symbol;
/**
* An Object whose own property names are property names that are excluded from the with
* environment bindings of the associated objects.
*/
unscopables: Symbol;
unscopables: symbol;
}
declare var Symbol: SymbolConstructor;
@@ -108,7 +108,7 @@ interface ObjectConstructor {
* Returns an array of all symbol properties found directly on object o.
* @param o Object to retrieve the symbols from.
*/
getOwnPropertySymbols(o: any): Symbol[];
getOwnPropertySymbols(o: any): symbol[];
/**
* Returns true if the values are the same value, false otherwise.
@@ -230,7 +230,7 @@ interface ArrayLike<T> {
interface Array<T> {
/** Iterator */
// [Symbol.iterator] (): Iterator<T>;
[Symbol.iterator] (): Iterator<T>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -329,7 +329,7 @@ interface ArrayConstructor {
interface String {
/** Iterator */
// [Symbol.iterator] (): Iterator<string>;
[Symbol.iterator] (): Iterator<string>;
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
@@ -447,12 +447,12 @@ interface IteratorResult<T> {
}
interface Iterator<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
next(): IteratorResult<T>;
}
interface Iterable<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
}
interface GeneratorFunction extends Function {
@@ -474,7 +474,7 @@ interface Generator<T> extends Iterator<T> {
next(value?: any): IteratorResult<T>;
throw (exception: any): IteratorResult<T>;
return (value: T): IteratorResult<T>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface Math {
@@ -588,11 +588,11 @@ interface Math {
*/
cbrt(x: number): number;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface RegExp {
// [Symbol.isRegExp]: boolean;
[Symbol.isRegExp]: boolean;
/**
* Matches a string with a regular expression, and returns an array containing the results of
@@ -649,8 +649,8 @@ interface Map<K, V> {
set(key: K, value?: V): Map<K, V>;
size: number;
values(): Iterator<V>;
// [Symbol.iterator]():Iterator<[K,V]>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<[K,V]>;
[Symbol.toStringTag]: string;
}
interface MapConstructor {
@@ -666,7 +666,7 @@ interface WeakMap<K, V> {
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakMapConstructor {
@@ -686,8 +686,8 @@ interface Set<T> {
keys(): Iterator<T>;
size: number;
values(): Iterator<T>;
// [Symbol.iterator]():Iterator<T>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<T>;
[Symbol.toStringTag]: string;
}
interface SetConstructor {
@@ -702,7 +702,7 @@ interface WeakSet<T> {
clear(): void;
delete(value: T): boolean;
has(value: T): boolean;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakSetConstructor {
@@ -713,7 +713,7 @@ interface WeakSetConstructor {
declare var WeakSet: WeakSetConstructor;
interface JSON {
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
/**
@@ -733,7 +733,7 @@ interface ArrayBuffer {
*/
slice(begin: number, end?: number): ArrayBuffer;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface ArrayBufferConstructor {
@@ -870,7 +870,7 @@ interface DataView {
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface DataViewConstructor {
@@ -1137,7 +1137,7 @@ interface Int8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int8ArrayConstructor {
@@ -1427,7 +1427,7 @@ interface Uint8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ArrayConstructor {
@@ -1717,7 +1717,7 @@ interface Uint8ClampedArray {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ClampedArrayConstructor {
@@ -2007,7 +2007,7 @@ interface Int16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int16ArrayConstructor {
@@ -2297,7 +2297,7 @@ interface Uint16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint16ArrayConstructor {
@@ -2587,7 +2587,7 @@ interface Int32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int32ArrayConstructor {
@@ -2877,7 +2877,7 @@ interface Uint32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint32ArrayConstructor {
@@ -3167,7 +3167,7 @@ interface Float32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float32ArrayConstructor {
@@ -3457,7 +3457,7 @@ interface Float64Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float64ArrayConstructor {
@@ -3521,7 +3521,7 @@ declare var Reflect: {
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
getPrototypeOf(target: any): any;
has(target: any, propertyKey: string): boolean;
has(target: any, propertyKey: Symbol): boolean;
has(target: any, propertyKey: symbol): boolean;
isExtensible(target: any): boolean;
ownKeys(target: any): Array<PropertyKey>;
preventExtensions(target: any): boolean;
+494
View File
@@ -0,0 +1,494 @@
/// <reference path="session.ts" />
module ts.server {
export interface SessionClientHost extends LanguageServiceHost {
writeMessage(message: string): void;
}
interface CompletionEntry extends CompletionInfo {
fileName: string;
position: number;
}
interface RenameEntry extends RenameInfo {
fileName: string;
position: number;
locations: RenameLocation[];
findInStrings: boolean;
findInComments: boolean;
}
export class SessionClient implements LanguageService {
private sequence: number = 0;
private fileMapping: ts.Map<string> = {};
private lineMaps: ts.Map<number[]> = {};
private messages: string[] = [];
private lastRenameEntry: RenameEntry;
constructor(private host: SessionClientHost) {
}
public onMessage(message: string): void {
this.messages.push(message);
}
private writeMessage(message: string): void {
this.host.writeMessage(message);
}
private getLineMap(fileName: string): number[] {
var lineMap = ts.lookUp(this.lineMaps, fileName);
if (!lineMap) {
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength()));
}
return lineMap;
}
private lineColToPosition(fileName: string, lineCol: protocol.Location): number {
return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1);
}
private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location {
var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position);
return {
line: lineCol.line + 1,
col: lineCol.character + 1
};
}
private convertCodeEditsToTextChange(fileName: string, codeEdit: protocol.CodeEdit): ts.TextChange {
var start = this.lineColToPosition(fileName, codeEdit.start);
var end = this.lineColToPosition(fileName, codeEdit.end);
return {
span: ts.createTextSpanFromBounds(start, end),
newText: codeEdit.newText
};
}
private processRequest<T extends protocol.Request>(command: string, arguments?: any): T {
var request: protocol.Request = {
seq: this.sequence++,
type: "request",
command: command,
arguments: arguments
};
this.writeMessage(JSON.stringify(request));
return <T>request;
}
private processResponse<T extends protocol.Response>(request: protocol.Request): T {
var lastMessage = this.messages.shift();
Debug.assert(!!lastMessage, "Did not recieve any responses.");
// Read the content length
var contentLengthPrefix = "Content-Length: ";
var lines = lastMessage.split("\r\n");
Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response.");
var contentLengthText = lines[0];
Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header.");
var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length));
// Read the body
var responseBody = lines[2];
// Verify content length
Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length.");
try {
var response: T = JSON.parse(responseBody);
}
catch (e) {
throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error detailes: " + e.message);
}
// verify the sequence numbers
Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number.");
// unmarshal errors
if (!response.success) {
throw new Error("Error " + response.message);
}
Debug.assert(!!response.body, "Malformed response: Unexpected empty response body.");
return response;
}
openFile(fileName: string): void {
var args: protocol.FileRequestArgs = { file: fileName };
this.processRequest(CommandNames.Open, args);
}
closeFile(fileName: string): void {
var args: protocol.FileRequestArgs = { file: fileName };
this.processRequest(CommandNames.Close, args);
}
changeFile(fileName: string, start: number, end: number, newText: string): void {
// clear the line map after an edit
this.lineMaps[fileName] = undefined;
var lineCol = this.positionToOneBasedLineCol(fileName, start);
var endLineCol = this.positionToOneBasedLineCol(fileName, end);
var args: protocol.ChangeRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
endLine: endLineCol.line,
endCol: endLineCol.col,
insertString: newText
};
this.processRequest(CommandNames.Change, args);
}
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.FileLocationRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col
};
var request = this.processRequest<protocol.QuickInfoRequest>(CommandNames.Quickinfo, args);
var response = this.processResponse<protocol.QuickInfoResponse>(request);
var start = this.lineColToPosition(fileName, response.body.start);
var end = this.lineColToPosition(fileName, response.body.end);
return {
kind: response.body.kind,
kindModifiers: response.body.kindModifiers,
textSpan: ts.createTextSpanFromBounds(start, end),
displayParts: [{ kind: "text", text: response.body.displayString }],
documentation: [{ kind: "text", text: response.body.documentation }]
};
}
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.CompletionsRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
prefix: undefined
};
var request = this.processRequest<protocol.CompletionsRequest>(CommandNames.Completions, args);
var response = this.processResponse<protocol.CompletionsResponse>(request);
return {
isMemberCompletion: false,
isNewIdentifierLocation: false,
entries: response.body,
fileName: fileName,
position: position
};
}
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.CompletionDetailsRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
entryNames: [entryName]
};
var request = this.processRequest<protocol.CompletionDetailsRequest>(CommandNames.CompletionDetails, args);
var response = this.processResponse<protocol.CompletionDetailsResponse>(request);
Debug.assert(response.body.length == 1, "Unexpected length of completion details response body.");
return response.body[0];
}
getNavigateToItems(searchTerm: string): NavigateToItem[] {
var args: protocol.NavtoRequestArgs = {
searchTerm,
file: this.host.getScriptFileNames()[0]
};
var request = this.processRequest<protocol.NavtoRequest>(CommandNames.Navto, args);
var response = this.processResponse<protocol.NavtoResponse>(request);
return response.body.map(entry => {
var fileName = entry.file;
var start = this.lineColToPosition(fileName, entry.start);
var end = this.lineColToPosition(fileName, entry.end);
return {
name: entry.name,
containerName: entry.containerName || "",
containerKind: entry.containerKind || "",
kind: entry.kind,
kindModifiers: entry.kindModifiers,
matchKind: entry.matchKind,
fileName: fileName,
textSpan: ts.createTextSpanFromBounds(start, end)
};
});
}
getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] {
var startLineCol = this.positionToOneBasedLineCol(fileName, start);
var endLineCol = this.positionToOneBasedLineCol(fileName, end);
var args: protocol.FormatRequestArgs = {
file: fileName,
line: startLineCol.line,
col: startLineCol.col,
endLine: endLineCol.line,
endCol: endLineCol.col,
};
// TODO: handle FormatCodeOptions
var request = this.processRequest<protocol.FormatRequest>(CommandNames.Format, args);
var response = this.processResponse<protocol.FormatResponse>(request);
return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry));
}
getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] {
return this.getFormattingEditsForRange(fileName, 0, this.host.getScriptSnapshot(fileName).getLength(), options);
}
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.FormatOnKeyRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
key: key
};
// TODO: handle FormatCodeOptions
var request = this.processRequest<protocol.FormatOnKeyRequest>(CommandNames.Formatonkey, args);
var response = this.processResponse<protocol.FormatResponse>(request);
return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry));
}
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.FileLocationRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
};
var request = this.processRequest<protocol.DefinitionRequest>(CommandNames.Definition, args);
var response = this.processResponse<protocol.DefinitionResponse>(request);
return response.body.map(entry => {
var fileName = entry.file;
var start = this.lineColToPosition(fileName, entry.start);
var end = this.lineColToPosition(fileName, entry.end);
return {
containerKind: "",
containerName: "",
fileName: fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
kind: "",
name: ""
};
});
}
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.FileLocationRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
};
var request = this.processRequest<protocol.ReferencesRequest>(CommandNames.References, args);
var response = this.processResponse<protocol.ReferencesResponse>(request);
return response.body.refs.map(entry => {
var fileName = entry.file;
var start = this.lineColToPosition(fileName, entry.start);
var end = this.lineColToPosition(fileName, entry.end);
return {
fileName: fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
isWriteAccess: entry.isWriteAccess,
};
});
}
getEmitOutput(fileName: string): EmitOutput {
throw new Error("Not Implemented Yet.");
}
getSyntacticDiagnostics(fileName: string): Diagnostic[] {
throw new Error("Not Implemented Yet.");
}
getSemanticDiagnostics(fileName: string): Diagnostic[] {
throw new Error("Not Implemented Yet.");
}
getCompilerOptionsDiagnostics(): Diagnostic[] {
throw new Error("Not Implemented Yet.");
}
getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.RenameRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
findInStrings,
findInComments
};
var request = this.processRequest<protocol.RenameRequest>(CommandNames.Rename, args);
var response = this.processResponse<protocol.RenameResponse>(request);
var locations: RenameLocation[] = [];
response.body.locs.map((entry: protocol.SpanGroup) => {
var fileName = entry.file;
entry.locs.map((loc: protocol.TextSpan) => {
var start = this.lineColToPosition(fileName, loc.start);
var end = this.lineColToPosition(fileName, loc.end);
locations.push({
textSpan: ts.createTextSpanFromBounds(start, end),
fileName: fileName
});
});
});
return this.lastRenameEntry = {
canRename: response.body.info.canRename,
displayName: response.body.info.displayName,
fullDisplayName: response.body.info.fullDisplayName,
kind: response.body.info.kind,
kindModifiers: response.body.info.kindModifiers,
localizedErrorMessage: response.body.info.localizedErrorMessage,
triggerSpan: ts.createTextSpanFromBounds(position, position),
fileName: fileName,
position: position,
findInStrings: findInStrings,
findInComments: findInComments,
locations: locations
};
}
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] {
if (!this.lastRenameEntry ||
this.lastRenameEntry.fileName !== fileName ||
this.lastRenameEntry.position !== position ||
this.lastRenameEntry.findInStrings != findInStrings ||
this.lastRenameEntry.findInComments != findInComments) {
this.getRenameInfo(fileName, position, findInStrings, findInComments);
}
return this.lastRenameEntry.locations;
}
decodeNavigationBarItems(items: protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] {
if (!items) {
return [];
}
return items.map(item => ({
text: item.text,
kind: item.kind,
kindModifiers: item.kindModifiers || "",
spans: item.spans.map(span=> createTextSpanFromBounds(this.lineColToPosition(fileName, span.start), this.lineColToPosition(fileName, span.end))),
childItems: this.decodeNavigationBarItems(item.childItems, fileName),
indent: 0,
bolded: false,
grayed: false
}));
}
getNavigationBarItems(fileName: string): NavigationBarItem[] {
var args: protocol.FileRequestArgs = {
file: fileName
};
var request = this.processRequest<protocol.NavBarRequest>(CommandNames.NavBar, args);
var response = this.processResponse<protocol.NavBarResponse>(request);
return this.decodeNavigationBarItems(response.body, fileName);
}
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
throw new Error("Not Implemented Yet.");
}
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan {
throw new Error("Not Implemented Yet.");
}
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
throw new Error("Not Implemented Yet.");
}
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
throw new Error("Not Implemented Yet.");
}
getOutliningSpans(fileName: string): OutliningSpan[] {
throw new Error("Not Implemented Yet.");
}
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
throw new Error("Not Implemented Yet.");
}
getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] {
var lineCol = this.positionToOneBasedLineCol(fileName, position);
var args: protocol.FileLocationRequestArgs = {
file: fileName,
line: lineCol.line,
col: lineCol.col,
};
var request = this.processRequest<protocol.BraceRequest>(CommandNames.Brace, args);
var response = this.processResponse<protocol.BraceResponse>(request);
return response.body.map(entry => {
var start = this.lineColToPosition(fileName, entry.start);
var end = this.lineColToPosition(fileName, entry.end);
return {
start: start,
length: end - start,
};
});
}
getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number {
throw new Error("Not Implemented Yet.");
}
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
throw new Error("Not Implemented Yet.");
}
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
throw new Error("Not Implemented Yet.");
}
getProgram(): Program {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
getSourceFile(fileName: string): SourceFile {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
cleanupSemanticCache(): void {
throw new Error("cleanupSemanticCache is not available through the server layer.");
}
dispose(): void {
throw new Error("dispose is not available through the server layer.");
}
}
}
File diff suppressed because it is too large Load Diff
+677
View File
@@ -0,0 +1,677 @@
// Type definitions for Node.js v0.10.1
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/************************************************
* *
* Node.js v0.10.1 API *
* *
************************************************/
/************************************************
* *
* GLOBAL *
* *
************************************************/
declare var process: NodeJS.Process;
declare var global: any;
declare var __filename: string;
declare var __dirname: string;
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
declare function clearTimeout(timeoutId: NodeJS.Timer): void;
declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
declare function clearInterval(intervalId: NodeJS.Timer): void;
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
declare function clearImmediate(immediateId: any): void;
declare var require: {
(id: string): any;
resolve(id: string): string;
cache: any;
extensions: any;
main: any;
};
declare var module: {
exports: any;
require(id: string): any;
id: string;
filename: string;
loaded: boolean;
parent: any;
children: any[];
};
// Same as module.exports
declare var exports: any;
declare var SlowBuffer: {
new (str: string, encoding?: string): Buffer;
new (size: number): Buffer;
new (size: Uint8Array): Buffer;
new (array: any[]): Buffer;
prototype: Buffer;
isBuffer(obj: any): boolean;
byteLength(string: string, encoding?: string): number;
concat(list: Buffer[], totalLength?: number): Buffer;
};
// Buffer class
interface Buffer extends NodeBuffer { }
interface BufferConstructor {
new (str: string, encoding ?: string): Buffer;
new (size: number): Buffer;
new (size: Uint8Array): Buffer;
new (array: any[]): Buffer;
prototype: Buffer;
isBuffer(obj: any): boolean;
byteLength(string: string, encoding ?: string): number;
concat(list: Buffer[], totalLength ?: number): Buffer;
}
declare var Buffer: BufferConstructor;
/************************************************
* *
* GLOBAL INTERFACES *
* *
************************************************/
declare module NodeJS {
export interface ErrnoException extends Error {
errno?: any;
code?: string;
path?: string;
syscall?: string;
}
export interface EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
export interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): any;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
unpipe<T extends WritableStream>(destination?: T): void;
unshift(chunk: string): void;
unshift(chunk: Buffer): void;
wrap(oldStream: ReadableStream): ReadableStream;
}
export interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
}
export interface ReadWriteStream extends ReadableStream, WritableStream { }
export interface Process extends EventEmitter {
stdout: WritableStream;
stderr: WritableStream;
stdin: ReadableStream;
argv: string[];
execPath: string;
abort(): void;
chdir(directory: string): void;
cwd(): string;
env: any;
exit(code?: number): void;
getgid(): number;
setgid(id: number): void;
setgid(id: string): void;
getuid(): number;
setuid(id: number): void;
setuid(id: string): void;
version: string;
versions: {
http_parser: string;
node: string;
v8: string;
ares: string;
uv: string;
zlib: string;
openssl: string;
};
config: {
target_defaults: {
cflags: any[];
default_configuration: string;
defines: string[];
include_dirs: string[];
libraries: string[];
};
variables: {
clang: number;
host_arch: string;
node_install_npm: boolean;
node_install_waf: boolean;
node_prefix: string;
node_shared_openssl: boolean;
node_shared_v8: boolean;
node_shared_zlib: boolean;
node_use_dtrace: boolean;
node_use_etw: boolean;
node_use_openssl: boolean;
target_arch: string;
v8_no_strict_aliasing: number;
v8_use_snapshot: boolean;
visibility: string;
};
};
kill(pid: number, signal?: string): void;
pid: number;
title: string;
arch: string;
platform: string;
memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; };
nextTick(callback: Function): void;
umask(mask?: number): number;
uptime(): number;
hrtime(time?: number[]): number[];
// Worker
send? (message: any, sendHandle?: any): void;
}
export interface Timer {
ref(): void;
unref(): void;
}
}
/**
* @deprecated
*/
interface NodeBuffer {
[index: number]: number;
write(string: string, offset?: number, length?: number, encoding?: string): number;
toString(encoding?: string, start?: number, end?: number): string;
toJSON(): any;
length: number;
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
slice(start?: number, end?: number): Buffer;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
readUInt32BE(offset: number, noAssert?: boolean): number;
readInt8(offset: number, noAssert?: boolean): number;
readInt16LE(offset: number, noAssert?: boolean): number;
readInt16BE(offset: number, noAssert?: boolean): number;
readInt32LE(offset: number, noAssert?: boolean): number;
readInt32BE(offset: number, noAssert?: boolean): number;
readFloatLE(offset: number, noAssert?: boolean): number;
readFloatBE(offset: number, noAssert?: boolean): number;
readDoubleLE(offset: number, noAssert?: boolean): number;
readDoubleBE(offset: number, noAssert?: boolean): number;
writeUInt8(value: number, offset: number, noAssert?: boolean): void;
writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
writeInt8(value: number, offset: number, noAssert?: boolean): void;
writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
fill(value: any, offset?: number, end?: number): void;
}
declare module NodeJS {
export interface Path {
normalize(p: string): string;
join(...paths: any[]): string;
resolve(...pathSegments: any[]): string;
relative(from: string, to: string): string;
dirname(p: string): string;
basename(p: string, ext?: string): string;
extname(p: string): string;
sep: string;
}
}
declare module NodeJS {
export interface ReadLineInstance extends EventEmitter {
setPrompt(prompt: string, length: number): void;
prompt(preserveCursor?: boolean): void;
question(query: string, callback: Function): void;
pause(): void;
resume(): void;
close(): void;
write(data: any, key?: any): void;
}
export interface ReadLineOptions {
input: NodeJS.ReadableStream;
output: NodeJS.WritableStream;
completer?: Function;
terminal?: boolean;
}
export interface ReadLine {
createInterface(options: ReadLineOptions): ReadLineInstance;
}
}
declare module NodeJS {
module events {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
}
}
declare module NodeJS {
module stream {
export interface Stream extends events.EventEmitter {
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
}
export interface ReadableOptions {
highWaterMark?: number;
encoding?: string;
objectMode?: boolean;
}
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
readable: boolean;
constructor(opts?: ReadableOptions);
_read(size: number): void;
read(size?: number): any;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
unshift(chunk: string): void;
unshift(chunk: Buffer): void;
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
push(chunk: any, encoding?: string): boolean;
}
export interface WritableOptions {
highWaterMark?: number;
decodeStrings?: boolean;
}
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
writable: boolean;
constructor(opts?: WritableOptions);
_write(data: Buffer, encoding: string, callback: Function): void;
_write(data: string, encoding: string, callback: Function): void;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
}
export interface DuplexOptions extends ReadableOptions, WritableOptions {
allowHalfOpen?: boolean;
}
// Note: Duplex extends both Readable and Writable.
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
writable: boolean;
constructor(opts?: DuplexOptions);
_write(data: Buffer, encoding: string, callback: Function): void;
_write(data: string, encoding: string, callback: Function): void;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
}
export interface TransformOptions extends ReadableOptions, WritableOptions { }
// Note: Transform lacks the _read and _write methods of Readable/Writable.
export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
readable: boolean;
writable: boolean;
constructor(opts?: TransformOptions);
_transform(chunk: Buffer, encoding: string, callback: Function): void;
_transform(chunk: string, encoding: string, callback: Function): void;
_flush(callback: Function): void;
read(size?: number): any;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
unshift(chunk: string): void;
unshift(chunk: Buffer): void;
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
push(chunk: any, encoding?: string): boolean;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
}
export class PassThrough extends Transform { }
}
}
declare module NodeJS {
module fs {
interface Stats {
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
dev: number;
ino: number;
mode: number;
nlink: number;
uid: number;
gid: number;
rdev: number;
size: number;
blksize: number;
blocks: number;
atime: Date;
mtime: Date;
ctime: Date;
}
interface FSWatcher extends events.EventEmitter {
close(): void;
}
export interface ReadStream extends stream.Readable { }
export interface WriteStream extends stream.Writable { }
export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function renameSync(oldPath: string, newPath: string): void;
export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function truncateSync(path: string, len?: number): void;
export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function ftruncateSync(fd: number, len?: number): void;
export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function chownSync(path: string, uid: number, gid: number): void;
export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function fchownSync(fd: number, uid: number, gid: number): void;
export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function lchownSync(path: string, uid: number, gid: number): void;
export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function chmodSync(path: string, mode: number): void;
export function chmodSync(path: string, mode: string): void;
export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function fchmodSync(fd: number, mode: number): void;
export function fchmodSync(fd: number, mode: string): void;
export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function lchmodSync(path: string, mode: number): void;
export function lchmodSync(path: string, mode: string): void;
export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function statSync(path: string): Stats;
export function lstatSync(path: string): Stats;
export function fstatSync(fd: number): Stats;
export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function linkSync(srcpath: string, dstpath: string): void;
export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
export function readlinkSync(path: string): string;
export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpath(path: string, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpathSync(path: string, cache?: { [path: string]: string }): string;
export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function unlinkSync(path: string): void;
export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function rmdirSync(path: string): void;
export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function mkdirSync(path: string, mode?: number): void;
export function mkdirSync(path: string, mode?: string): void;
export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void;
export function readdirSync(path: string): string[];
export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function closeSync(fd: number): void;
export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
export function openSync(path: string, flags: string, mode?: number): number;
export function openSync(path: string, flags: string, mode?: string): number;
export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function utimesSync(path: string, atime: number, mtime: number): void;
export function utimesSync(path: string, atime: Date, mtime: Date): void;
export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function futimesSync(fd: number, atime: number, mtime: number): void;
export function futimesSync(fd: number, atime: Date, mtime: Date): void;
export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
export function fsyncSync(fd: number): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFileSync(filename: string, encoding: string): string;
export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
export function exists(path: string, callback?: (exists: boolean) => void): void;
export function existsSync(path: string): boolean;
export function createReadStream(path: string, options?: {
flags?: string;
encoding?: string;
fd?: string;
mode?: number;
bufferSize?: number;
}): ReadStream;
export function createReadStream(path: string, options?: {
flags?: string;
encoding?: string;
fd?: string;
mode?: string;
bufferSize?: number;
}): ReadStream;
export function createWriteStream(path: string, options?: {
flags?: string;
encoding?: string;
string?: string;
}): WriteStream;
}
}
declare module NodeJS {
module path {
export function normalize(p: string): string;
export function join(...paths: any[]): string;
export function resolve(...pathSegments: any[]): string;
export function relative(from: string, to: string): string;
export function dirname(p: string): string;
export function basename(p: string, ext?: string): string;
export function extname(p: string): string;
export var sep: string;
}
}
declare module NodeJS {
module _debugger {
export interface Packet {
raw: string;
headers: string[];
body: Message;
}
export interface Message {
seq: number;
type: string;
}
export interface RequestInfo {
command: string;
arguments: any;
}
export interface Request extends Message, RequestInfo {
}
export interface Event extends Message {
event: string;
body?: any;
}
export interface Response extends Message {
request_seq: number;
success: boolean;
/** Contains error message if success == false. */
message?: string;
/** Contains message body if success == true. */
body?: any;
}
export interface BreakpointMessageBody {
type: string;
target: number;
line: number;
}
export class Protocol {
res: Packet;
state: string;
execute(data: string): void;
serialize(rq: Request): string;
onResponse: (pkt: Packet) => void;
}
export var NO_FRAME: number;
export var port: number;
export interface ScriptDesc {
name: string;
id: number;
isNative?: boolean;
handle?: number;
type: string;
lineOffset?: number;
columnOffset?: number;
lineCount?: number;
}
export interface Breakpoint {
id: number;
scriptId: number;
script: ScriptDesc;
line: number;
condition?: string;
scriptReq?: string;
}
export interface RequestHandler {
(err: boolean, body: Message, res: Packet): void;
request_seq?: number;
}
export interface ResponseBodyHandler {
(err: boolean, body?: any): void;
request_seq?: number;
}
export interface ExceptionInfo {
text: string;
}
export interface BreakResponse {
script?: ScriptDesc;
exception?: ExceptionInfo;
sourceLine: number;
sourceLineText: string;
sourceColumn: number;
}
export function SourceInfo(body: BreakResponse): string;
export class Client extends events.EventEmitter {
protocol: Protocol;
scripts: ScriptDesc[];
handles: ScriptDesc[];
breakpoints: Breakpoint[];
currentSourceLine: number;
currentSourceColumn: number;
currentSourceLineText: string;
currentFrame: number;
currentScript: string;
connect(port: number, host: string): void;
req(req: any, cb: RequestHandler): void;
reqFrameEval(code: string, frame: number, cb: RequestHandler): void;
mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void;
setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void;
clearBreakpoint(rq: Request, cb: RequestHandler): void;
listbreakpoints(cb: RequestHandler): void;
reqSource(from: number, to: number, cb: RequestHandler): void;
reqScripts(cb: any): void;
reqContinue(cb: RequestHandler): void;
}
}
}
+823
View File
@@ -0,0 +1,823 @@
/**
* Declaration module describing the TypeScript Server protocol
*/
declare module ts.server.protocol {
/**
* A TypeScript Server message
*/
export interface Message {
/**
* Sequence number of the message
*/
seq: number;
/**
* One of "request", "response", or "event"
*/
type: string;
}
/**
* Client-initiated request message
*/
export interface Request extends Message {
/**
* The command to execute
*/
command: string;
/**
* Object containing arguments for the command
*/
arguments?: any;
}
/**
* Server-initiated event message
*/
export interface Event extends Message {
/**
* Name of event
*/
event: string;
/**
* Event-specific information
*/
body?: any;
}
/**
* Response by server to client request message.
*/
export interface Response extends Message {
/**
* Sequence number of the request message.
*/
request_seq: number;
/**
* Outcome of the request.
*/
success: boolean;
/**
* The command requested.
*/
command: string;
/**
* Contains error message if success == false.
*/
message?: string;
/**
* Contains message body if success == true.
*/
body?: any;
}
/**
* Arguments for FileRequest messages.
*/
export interface FileRequestArgs {
/**
* The file for the request (absolute pathname required).
*/
file: string;
}
/**
* Request whose sole parameter is a file name.
*/
export interface FileRequest extends Request {
arguments: FileRequestArgs;
}
/**
* Instances of this interface specify a location in a source file:
* (file, line, col), where line and column are 1-based.
*/
export interface FileLocationRequestArgs extends FileRequestArgs {
/**
* The line number for the request (1-based).
*/
line: number;
/**
* The column for the request (1-based).
*/
col: number;
}
/**
* A request whose arguments specify a file location (file, line, col).
*/
export interface FileLocationRequest extends FileRequest {
arguments: FileLocationRequestArgs;
}
/**
* Go to definition request; value of command field is
* "definition". Return response giving the file locations that
* define the symbol found in file at location line, col.
*/
export interface DefinitionRequest extends FileLocationRequest {
}
/**
* Location in source code expressed as (one-based) line and column.
*/
export interface Location {
line: number;
col: number;
}
/**
* Object found in response messages defining a span of text in source code.
*/
export interface TextSpan {
/**
* First character of the definition.
*/
start: Location;
/**
* One character past last character of the definition.
*/
end: Location;
}
/**
* Object found in response messages defining a span of text in a specific source file.
*/
export interface FileSpan extends TextSpan {
/**
* File containing text span.
*/
file: string;
}
/**
* Definition response message. Gives text range for definition.
*/
export interface DefinitionResponse extends Response {
body?: FileSpan[];
}
/**
* Find references request; value of command field is
* "references". Return response giving the file locations that
* reference the symbol found in file at location line, col.
*/
export interface ReferencesRequest extends FileLocationRequest {
}
export interface ReferencesResponseItem extends FileSpan {
/** Text of line containing the reference. Including this
* with the response avoids latency of editor loading files
* to show text of reference line (the server already has
* loaded the referencing files).
*/
lineText: string;
/**
* True if reference is a write location, false otherwise.
*/
isWriteAccess: boolean;
}
/**
* The body of a "references" response message.
*/
export interface ReferencesResponseBody {
/**
* The file locations referencing the symbol.
*/
refs: ReferencesResponseItem[];
/**
* The name of the symbol.
*/
symbolName: string;
/**
* The start column of the symbol (on the line provided by the references request).
*/
symbolStartCol: number;
/**
* The full display name of the symbol.
*/
symbolDisplayString: string;
}
/**
* Response to "references" request.
*/
export interface ReferencesResponse extends Response {
body?: ReferencesResponseBody;
}
export interface RenameRequestArgs extends FileLocationRequestArgs {
findInComments?: boolean;
findInStrings?: boolean;
}
/**
* Rename request; value of command field is "rename". Return
* response giving the file locations that reference the symbol
* found in file at location line, col. Also return full display
* name of the symbol so that client can print it unambiguously.
*/
export interface RenameRequest extends FileLocationRequest {
arguments: RenameRequestArgs;
}
/**
* Information about the item to be renamed.
*/
export interface RenameInfo {
/**
* True if item can be renamed.
*/
canRename: boolean;
/**
* Error message if item can not be renamed.
*/
localizedErrorMessage?: string;
/**
* Display name of the item to be renamed.
*/
displayName: string;
/**
* Full display name of item to be renamed.
*/
fullDisplayName: string;
/**
* The items's kind (such as 'className' or 'parameterName' or plain 'text').
*/
kind: string;
/**
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers: string;
}
/**
* A group of text spans, all in 'file'.
*/
export interface SpanGroup {
/** The file to which the spans apply */
file: string;
/** The text spans in this group */
locs: TextSpan[];
}
export interface RenameResponseBody {
/**
* Information about the item to be renamed.
*/
info: RenameInfo;
/**
* An array of span groups (one per file) that refer to the item to be renamed.
*/
locs: SpanGroup[];
}
/**
* Rename response message.
*/
export interface RenameResponse extends Response {
body?: RenameResponseBody;
}
/**
* Open request; value of command field is "open". Notify the
* server that the client has file open. The server will not
* monitor the filesystem for changes in this file and will assume
* that the client is updating the server (using the change and/or
* reload messages) when the file changes. Server does not currently
* send a response to an open request.
*/
export interface OpenRequest extends FileRequest {
}
/**
* Close request; value of command field is "close". Notify the
* server that the client has closed a previously open file. If
* file is still referenced by open files, the server will resume
* monitoring the filesystem for changes to file. Server does not
* currently send a response to a close request.
*/
export interface CloseRequest extends FileRequest {
}
/**
* Quickinfo request; value of command field is
* "quickinfo". Return response giving a quick type and
* documentation string for the symbol found in file at location
* line, col.
*/
export interface QuickInfoRequest extends FileLocationRequest {
}
/**
* Body of QuickInfoResponse.
*/
export interface QuickInfoResponseBody {
/**
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
*/
kind: string;
/**
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers: string;
/**
* Starting file location of symbol.
*/
start: Location;
/**
* One past last character of symbol.
*/
end: Location;
/**
* Type and kind of symbol.
*/
displayString: string;
/**
* Documentation associated with symbol.
*/
documentation: string;
}
/**
* Quickinfo response message.
*/
export interface QuickInfoResponse extends Response {
body?: QuickInfoResponseBody;
}
/**
* Arguments for format messages.
*/
export interface FormatRequestArgs extends FileLocationRequestArgs {
/**
* Last line of range for which to format text in file.
*/
endLine: number;
/**
* Last column of range for which to format text in file.
*/
endCol: number;
}
/**
* Format request; value of command field is "format". Return
* response giving zero or more edit instructions. The edit
* instructions will be sorted in file order. Applying the edit
* instructions in reverse to file will result in correctly
* reformatted text.
*/
export interface FormatRequest extends FileLocationRequest {
arguments: FormatRequestArgs;
}
/**
* Object found in response messages defining an editing
* instruction for a span of text in source code. The effect of
* this instruction is to replace the text starting at start and
* ending one character before end with newText. For an insertion,
* the text span is empty. For a deletion, newText is empty.
*/
export interface CodeEdit {
/**
* First character of the text span to edit.
*/
start: Location;
/**
* One character past last character of the text span to edit.
*/
end: Location;
/**
* Replace the span defined above with this string (may be
* the empty string).
*/
newText: string;
}
/**
* Format and format on key response message.
*/
export interface FormatResponse extends Response {
body?: CodeEdit[];
}
/**
* Arguments for format on key messages.
*/
export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
/**
* Key pressed (';', '\n', or '}').
*/
key: string;
}
/**
* Format on key request; value of command field is
* "formatonkey". Given file location and key typed (as string),
* return response giving zero or more edit instructions. The
* edit instructions will be sorted in file order. Applying the
* edit instructions in reverse to file will result in correctly
* reformatted text.
*/
export interface FormatOnKeyRequest extends FileLocationRequest {
arguments: FormatOnKeyRequestArgs;
}
/**
* Arguments for completions messages.
*/
export interface CompletionsRequestArgs extends FileLocationRequestArgs {
/**
* Optional prefix to apply to possible completions.
*/
prefix?: string;
}
/**
* Completions request; value of command field is "completions".
* Given a file location (file, line, col) and a prefix (which may
* be the empty string), return the possible completions that
* begin with prefix.
*/
export interface CompletionsRequest extends FileLocationRequest {
arguments: CompletionsRequestArgs;
}
/**
* Arguments for completion details request.
*/
export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
/**
* Names of one or more entries for which to obtain details.
*/
entryNames: string[];
}
/**
* Completion entry details request; value of command field is
* "completionEntryDetails". Given a file location (file, line,
* col) and an array of completion entry names return more
* detailed information for each completion entry.
*/
export interface CompletionDetailsRequest extends FileLocationRequest {
arguments: CompletionDetailsRequestArgs;
}
/**
* Part of a symbol description.
*/
export interface SymbolDisplayPart {
/**
* Text of an item describing the symbol.
*/
text: string;
/**
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
*/
kind: string;
}
/**
* An item found in a completion response.
*/
export interface CompletionEntry {
/**
* The symbol's name.
*/
name: string;
/**
* The symbol's kind (such as 'className' or 'parameterName').
*/
kind: string;
/**
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers: string;
}
/**
* Additional completion entry details, available on demand
*/
export interface CompletionEntryDetails extends CompletionEntry {
/**
* Display parts of the symbol (similar to quick info).
*/
displayParts: SymbolDisplayPart[];
/**
* Documentation strings for the symbol.
*/
documentation: SymbolDisplayPart[];
}
export interface CompletionsResponse extends Response {
body?: CompletionEntry[];
}
export interface CompletionDetailsResponse extends Response {
body?: CompletionEntryDetails[];
}
/**
* Arguments for geterr messages.
*/
export interface GeterrRequestArgs {
/**
* List of file names for which to compute compiler errors.
* The files will be checked in list order.
*/
files: string[];
/**
* Delay in milliseconds to wait before starting to compute
* errors for the files in the file list
*/
delay: number;
}
/**
* Geterr request; value of command field is "geterr". Wait for
* delay milliseconds and then, if during the wait no change or
* reload messages have arrived for the first file in the files
* list, get the syntactic errors for the file, field requests,
* and then get the semantic errors for the file. Repeat with a
* smaller delay for each subsequent file on the files list. Best
* practice for an editor is to send a file list containing each
* file that is currently visible, in most-recently-used order.
*/
export interface GeterrRequest extends Request {
arguments: GeterrRequestArgs;
}
/**
* Item of diagnostic information found in a DiagnosticEvent message.
*/
export interface Diagnostic {
/**
* Starting file location at which text appies.
*/
start: Location;
/**
* The last file location at which the text applies.
*/
end: Location;
/**
* Text of diagnostic message.
*/
text: string;
}
export interface DiagnosticEventBody {
/**
* The file for which diagnostic information is reported.
*/
file: string;
/**
* An array of diagnostic information items.
*/
diagnostics: Diagnostic[];
}
/**
* Event message for "syntaxDiag" and "semanticDiag" event types.
* These events provide syntactic and semantic errors for a file.
*/
export interface DiagnosticEvent extends Event {
body?: DiagnosticEventBody;
}
/**
* Arguments for reload request.
*/
export interface ReloadRequestArgs extends FileRequestArgs {
/**
* Name of temporary file from which to reload file
* contents. May be same as file.
*/
tmpfile: string;
}
/**
* Reload request message; value of command field is "reload".
* Reload contents of file with name given by the 'file' argument
* from temporary file with name given by the 'tmpfile' argument.
* The two names can be identical.
*/
export interface ReloadRequest extends FileRequest {
arguments: ReloadRequestArgs;
}
/**
* Response to "reload" request. This is just an acknowledgement, so
* no body field is required.
*/
export interface ReloadResponse extends Response {
}
/**
* Arguments for saveto request.
*/
export interface SavetoRequestArgs extends FileRequestArgs {
/**
* Name of temporary file into which to save server's view of
* file contents.
*/
tmpfile: string;
}
/**
* Saveto request message; value of command field is "saveto".
* For debugging purposes, save to a temporaryfile (named by
* argument 'tmpfile') the contents of file named by argument
* 'file'. The server does not currently send a response to a
* "saveto" request.
*/
export interface SavetoRequest extends FileRequest {
arguments: SavetoRequestArgs;
}
/**
* Arguments for navto request message.
*/
export interface NavtoRequestArgs extends FileRequestArgs {
/**
* Search term to navigate to from current location; term can
* be '.*' or an identifier prefix.
*/
searchTerm: string;
}
/**
* Navto request message; value of command field is "navto".
* Return list of objects giving file locations and symbols that
* match the search term given in argument 'searchTerm'. The
* context for the search is given by the named file.
*/
export interface NavtoRequest extends FileRequest {
arguments: NavtoRequestArgs;
}
/**
* An item found in a navto response.
*/
export interface NavtoItem {
/**
* The symbol's name.
*/
name: string;
/**
* The symbol's kind (such as 'className' or 'parameterName').
*/
kind: string;
/**
* exact, substring, or prefix.
*/
matchKind?: string;
/**
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers?: string;
/**
* The file in which the symbol is found.
*/
file: string;
/**
* The location within file at which the symbol is found.
*/
start: Location;
/**
* One past the last character of the symbol.
*/
end: Location;
/**
* Name of symbol's container symbol (if any); for example,
* the class name if symbol is a class member.
*/
containerName?: string;
/**
* Kind of symbol's container symbol (if any).
*/
containerKind?: string;
}
/**
* Navto response message. Body is an array of navto items. Each
* item gives a symbol that matched the search term.
*/
export interface NavtoResponse extends Response {
body?: NavtoItem[];
}
/**
* Arguments for change request message.
*/
export interface ChangeRequestArgs extends FormatRequestArgs {
/**
* Optional string to insert at location (file, line, col).
*/
insertString?: string;
}
/**
* Change request message; value of command field is "change".
* Update the server's view of the file named by argument 'file'.
* Server does not currently send a response to a change request.
*/
export interface ChangeRequest extends FileLocationRequest {
arguments: ChangeRequestArgs;
}
/**
* Response to "brace" request.
*/
export interface BraceResponse extends Response {
body?: TextSpan[];
}
/**
* Brace matching request; value of command field is "brace".
* Return response giving the file locations of matching braces
* found in file at location line, col.
*/
export interface BraceRequest extends FileLocationRequest {
}
/**
* NavBar itesm request; value of command field is "navbar".
* Return response giving the list of navigation bar entries
* extracted from the requested file.
*/
export interface NavBarRequest extends FileRequest {
}
export interface NavigationBarItem {
/**
* The item's display text.
*/
text: string;
/**
* The symbol's kind (such as 'className' or 'parameterName').
*/
kind: string;
/**
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers?: string;
/**
* The definition locations of the item.
*/
spans: TextSpan[];
/**
* Optional children.
*/
childItems?: NavigationBarItem[];
}
export interface NavBarResponse extends Response {
body?: NavigationBarItem[];
}
}
+219
View File
@@ -0,0 +1,219 @@
/// <reference path="node.d.ts" />
/// <reference path="session.ts" />
module ts.server {
var nodeproto: typeof NodeJS._debugger = require('_debugger');
var readline: NodeJS.ReadLine = require('readline');
var path: NodeJS.Path = require('path');
var fs: typeof NodeJS.fs = require('fs');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
class Logger implements ts.server.Logger {
fd = -1;
seq = 0;
inGroup = false;
firstInGroup = true;
constructor(public logFilename: string) {
}
static padStringRight(str: string, padding: string) {
return (str + padding).slice(0, padding.length);
}
close() {
if (this.fd >= 0) {
fs.close(this.fd);
}
}
perftrc(s: string) {
this.msg(s, "Perf");
}
info(s: string) {
this.msg(s, "Info");
}
startGroup() {
this.inGroup = true;
this.firstInGroup = true;
}
endGroup() {
this.inGroup = false;
this.seq++;
this.firstInGroup = true;
}
msg(s: string, type = "Err") {
if (this.fd < 0) {
this.fd = fs.openSync(this.logFilename, "w");
}
if (this.fd >= 0) {
s = s + "\n";
var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
if (this.firstInGroup) {
s = prefix + s;
this.firstInGroup = false;
}
if (!this.inGroup) {
this.seq++;
this.firstInGroup = true;
}
var buf = new Buffer(s);
fs.writeSync(this.fd, buf, 0, buf.length, null);
}
}
}
interface WatchedFile {
fileName: string;
callback: (fileName: string) => void;
mtime: Date;
}
class WatchedFileSet {
private watchedFiles: WatchedFile[] = [];
private nextFileToCheck = 0;
private watchTimer: NodeJS.Timer;
private static fileDeleted = 34;
// average async stat takes about 30 microseconds
// set chunk size to do 30 files in < 1 millisecond
constructor(public interval = 2500, public chunkSize = 30) {
}
private static copyListRemovingItem<T>(item: T, list: T[]) {
var copiedList: T[] = [];
for (var i = 0, len = list.length; i < len; i++) {
if (list[i] != item) {
copiedList.push(list[i]);
}
}
return copiedList;
}
private static getModifiedTime(fileName: string): Date {
return fs.statSync(fileName).mtime;
}
private poll(checkedIndex: number) {
var watchedFile = this.watchedFiles[checkedIndex];
if (!watchedFile) {
return;
}
fs.stat(watchedFile.fileName,(err, stats) => {
if (err) {
var msg = err.message;
if (err.errno) {
msg += " errno: " + err.errno.toString();
}
if (err.errno == WatchedFileSet.fileDeleted) {
watchedFile.callback(watchedFile.fileName);
}
}
else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) {
watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName);
watchedFile.callback(watchedFile.fileName);
}
});
}
// this implementation uses polling and
// stat due to inconsistencies of fs.watch
// and efficiency of stat on modern filesystems
private startWatchTimer() {
this.watchTimer = setInterval(() => {
var count = 0;
var nextToCheck = this.nextFileToCheck;
var firstCheck = -1;
while ((count < this.chunkSize) && (nextToCheck != firstCheck)) {
this.poll(nextToCheck);
if (firstCheck < 0) {
firstCheck = nextToCheck;
}
nextToCheck++;
if (nextToCheck === this.watchedFiles.length) {
nextToCheck = 0;
}
count++;
}
this.nextFileToCheck = nextToCheck;
}, this.interval);
}
addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile {
var file: WatchedFile = {
fileName,
callback,
mtime: WatchedFileSet.getModifiedTime(fileName)
};
this.watchedFiles.push(file);
if (this.watchedFiles.length === 1) {
this.startWatchTimer();
}
return file;
}
removeFile(file: WatchedFile) {
this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles);
}
}
class IOSession extends Session {
constructor(host: ServerHost, logger: ts.server.Logger) {
super(host, logger);
}
listen() {
rl.on('line',(input: string) => {
var message = input.trim();
this.onMessage(message);
});
rl.on('close',() => {
this.projectService.closeLog();
this.projectService.log("Exiting...");
process.exit(0);
});
}
}
// This places log file in the directory containing editorServices.js
// TODO: check that this location is writable
var logger = new Logger(__dirname + "/.log" + process.pid.toString());
// REVIEW: for now this implementation uses polling.
// The advantage of polling is that it works reliably
// on all os and with network mounted files.
// For 90 referenced files, the average time to detect
// changes is 2*msInterval (by default 5 seconds).
// The overhead of this is .04 percent (1/2500) with
// average pause of < 1 millisecond (and max
// pause less than 1.5 milliseconds); question is
// do we anticipate reference sets in the 100s and
// do we care about waiting 10-20 seconds to detect
// changes for large reference sets? If so, do we want
// to increase the chunk size or decrease the interval
// time dynamically to match the large reference set?
var watchedFileSet = new WatchedFileSet();
ts.sys.watchFile = function (fileName, callback) {
var watchedFile = watchedFileSet.addFile(fileName, callback);
return {
close: () => watchedFileSet.removeFile(watchedFile)
}
};
// Start listening
new IOSession(ts.sys, logger).listen();
}
+801
View File
@@ -0,0 +1,801 @@
/// <reference path="..\compiler\commandLineParser.ts" />
/// <reference path="..\services\services.ts" />
/// <reference path="node.d.ts" />
/// <reference path="protocol.d.ts" />
/// <reference path="editorServices.ts" />
module ts.server {
var spaceCache = [" ", " ", " ", " "];
interface StackTraceError extends Error {
stack?: string;
}
function generateSpaces(n: number): string {
if (!spaceCache[n]) {
var strBuilder = "";
for (var i = 0; i < n; i++) {
strBuilder += " ";
}
spaceCache[n] = strBuilder;
}
return spaceCache[n];
}
interface FileStart {
file: string;
start: ILineInfo;
}
function compareNumber(a: number, b: number) {
if (a < b) {
return -1;
}
else if (a == b) {
return 0;
}
else return 1;
}
function compareFileStart(a: FileStart, b: FileStart) {
if (a.file < b.file) {
return -1;
}
else if (a.file == b.file) {
var n = compareNumber(a.start.line, b.start.line);
if (n == 0) {
return compareNumber(a.start.col, b.start.col);
}
else return n;
}
else {
return 1;
}
}
function sortNavItems(items: ts.NavigateToItem[]) {
return items.sort((a, b) => {
if (a.matchKind < b.matchKind) {
return -1;
}
else if (a.matchKind == b.matchKind) {
var lowa = a.name.toLowerCase();
var lowb = b.name.toLowerCase();
if (lowa < lowb) {
return -1;
}
else if (lowa == lowb) {
return 0;
}
else {
return 1;
}
}
else {
return 1;
}
})
}
function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) {
return {
start: project.compilerService.host.positionToLineCol(fileName, diag.start),
end: project.compilerService.host.positionToLineCol(fileName, diag.start + diag.length),
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
};
}
interface PendingErrorCheck {
fileName: string;
project: Project;
}
function allEditsBeforePos(edits: ts.TextChange[], pos: number) {
for (var i = 0, len = edits.length; i < len; i++) {
if (ts.textSpanEnd(edits[i].span) >= pos) {
return false;
}
}
return true;
}
export module CommandNames {
export var Change = "change";
export var Close = "close";
export var Completions = "completions";
export var CompletionDetails = "completionEntryDetails";
export var Definition = "definition";
export var Format = "format";
export var Formatonkey = "formatonkey";
export var Geterr = "geterr";
export var NavBar = "navbar";
export var Navto = "navto";
export var Open = "open";
export var Quickinfo = "quickinfo";
export var References = "references";
export var Reload = "reload";
export var Rename = "rename";
export var Saveto = "saveto";
export var Brace = "brace";
export var Unknown = "unknown";
}
module Errors {
export var NoProject = new Error("No Project.");
export var NoContent = new Error("No Content.");
}
export interface ServerHost extends ts.System {
}
export class Session {
projectService: ProjectService;
pendingOperation = false;
fileHash: ts.Map<number> = {};
nextFileId = 1;
errorTimer: NodeJS.Timer;
immediateId: any;
changeSeq = 0;
constructor(private host: ServerHost, private logger: Logger) {
this.projectService = new ProjectService(host, logger);
}
logError(err: Error, cmd: string) {
var typedErr = <StackTraceError>err;
var msg = "Exception on executing command " + cmd;
if (typedErr.message) {
msg += ":\n" + typedErr.message;
if (typedErr.stack) {
msg += "\n" + typedErr.stack;
}
}
this.projectService.log(msg);
}
sendLineToClient(line: string) {
this.host.write(line + this.host.newLine);
}
send(msg: NodeJS._debugger.Message) {
var json = JSON.stringify(msg);
this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) +
'\r\n\r\n' + json);
}
event(info: any, eventName: string) {
var ev: NodeJS._debugger.Event = {
seq: 0,
type: "event",
event: eventName,
body: info,
};
this.send(ev);
}
response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) {
var res: protocol.Response = {
seq: 0,
type: "response",
command: cmdName,
request_seq: reqSeq,
success: !errorMsg,
}
if (!errorMsg) {
res.body = info;
}
else {
res.message = errorMsg;
}
this.send(res);
}
output(body: any, commandName: string, requestSequence = 0, errorMessage?: string) {
this.response(body, commandName, requestSequence, errorMessage);
}
semanticCheck(file: string, project: Project) {
var diags = project.compilerService.languageService.getSemanticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag");
}
}
syntacticCheck(file: string, project: Project) {
var diags = project.compilerService.languageService.getSyntacticDiagnostics(file);
if (diags) {
var bakedDiags = diags.map((diag) => formatDiag(file, project, diag));
this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag");
}
}
errorCheck(file: string, project: Project) {
this.syntacticCheck(file, project);
this.semanticCheck(file, project);
}
updateErrorCheck(checkList: PendingErrorCheck[], seq: number,
matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) {
if (followMs > ms) {
followMs = ms;
}
if (this.errorTimer) {
clearTimeout(this.errorTimer);
}
if (this.immediateId) {
clearImmediate(this.immediateId);
this.immediateId = undefined;
}
var index = 0;
var checkOne = () => {
if (matchSeq(seq)) {
var checkSpec = checkList[index++];
if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) {
this.syntacticCheck(checkSpec.fileName, checkSpec.project);
this.immediateId = setImmediate(() => {
this.semanticCheck(checkSpec.fileName, checkSpec.project);
this.immediateId = undefined;
if (checkList.length > index) {
this.errorTimer = setTimeout(checkOne, followMs);
}
else {
this.errorTimer = undefined;
}
});
}
}
}
if ((checkList.length > index) && (matchSeq(seq))) {
this.errorTimer = setTimeout(checkOne, ms);
}
}
getDefinition(line: number, col: number, fileName: string): protocol.FileSpan[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var definitions = compilerService.languageService.getDefinitionAtPosition(file, position);
if (!definitions) {
throw Errors.NoContent;
}
return definitions.map(def => ({
file: def.fileName,
start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start),
end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan))
}));
}
getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var renameInfo = compilerService.languageService.getRenameInfo(file, position);
if (!renameInfo) {
throw Errors.NoContent;
}
if (!renameInfo.canRename) {
return {
info: renameInfo,
locs: []
};
}
var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments);
if (!renameLocations) {
throw Errors.NoContent;
}
var bakedRenameLocs = renameLocations.map(location => (<protocol.FileSpan>{
file: location.fileName,
start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start),
end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)),
})).sort((a, b) => {
if (a.file < b.file) {
return -1;
}
else if (a.file > b.file) {
return 1;
}
else {
// reverse sort assuming no overlap
if (a.start.line < b.start.line) {
return 1;
}
else if (a.start.line > b.start.line) {
return -1;
}
else {
return b.start.col - a.start.col;
}
}
}).reduce<protocol.SpanGroup[]>((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => {
var curFileAccum: protocol.SpanGroup;
if (accum.length > 0) {
curFileAccum = accum[accum.length - 1];
if (curFileAccum.file != cur.file) {
curFileAccum = undefined;
}
}
if (!curFileAccum) {
curFileAccum = { file: cur.file, locs: [] };
accum.push(curFileAccum);
}
curFileAccum.locs.push({ start: cur.start, end: cur.end });
return accum;
}, []);
return { info: renameInfo, locs: bakedRenameLocs };
}
getReferences(line: number, col: number, fileName: string): protocol.ReferencesResponseBody {
// TODO: get all projects for this file; report refs for all projects deleting duplicates
// can avoid duplicates by eliminating same ref file from subsequent projects
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var references = compilerService.languageService.getReferencesAtPosition(file, position);
if (!references) {
throw Errors.NoContent;
}
var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position);
if (!nameInfo) {
throw Errors.NoContent;
}
var displayString = ts.displayPartsToString(nameInfo.displayParts);
var nameSpan = nameInfo.textSpan;
var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col;
var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan));
var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => {
var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start);
var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1);
var snap = compilerService.host.getScriptSnapshot(ref.fileName);
var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, "");
return {
file: ref.fileName,
start: start,
lineText: lineText,
end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)),
isWriteAccess: ref.isWriteAccess
};
}).sort(compareFileStart);
return {
refs: bakedRefs,
symbolName: nameText,
symbolStartCol: nameColStart,
symbolDisplayString: displayString
};
}
openClientFile(fileName: string) {
var file = ts.normalizePath(fileName);
this.projectService.openClientFile(file);
}
getQuickInfo(line: number, col: number, fileName: string): protocol.QuickInfoResponseBody {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position);
if (!quickInfo) {
throw Errors.NoContent;
}
var displayString = ts.displayPartsToString(quickInfo.displayParts);
var docString = ts.displayPartsToString(quickInfo.documentation);
return {
kind: quickInfo.kind,
kindModifiers: quickInfo.kindModifiers,
start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start),
end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)),
displayString: displayString,
documentation: docString,
};
}
getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): protocol.CodeEdit[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var startPosition = compilerService.host.lineColToPosition(file, line, col);
var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol);
// TODO: avoid duplicate code (with formatonkey)
var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions);
if (!edits) {
throw Errors.NoContent;
}
return edits.map((edit) => {
return {
start: compilerService.host.positionToLineCol(file, edit.span.start),
end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(edit.span)),
newText: edit.newText ? edit.newText : ""
};
});
}
getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): protocol.CodeEdit[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key,
compilerService.formatCodeOptions);
if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) {
// TODO: get these options from host
var editorOptions: ts.EditorOptions = {
IndentSize: 4,
TabSize: 4,
NewLineCharacter: "\n",
ConvertTabsToSpaces: true,
};
var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
var spaces = generateSpaces(indentPosition);
if (indentPosition > 0) {
edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces });
}
}
if (!edits) {
throw Errors.NoContent;
}
return edits.map((edit) => {
return {
start: compilerService.host.positionToLineCol(file,
edit.span.start),
end: compilerService.host.positionToLineCol(file,
ts.textSpanEnd(edit.span)),
newText: edit.newText ? edit.newText : ""
};
});
}
getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionEntry[] {
if (!prefix) {
prefix = "";
}
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var completions = compilerService.languageService.getCompletionsAtPosition(file, position);
if (!completions) {
throw Errors.NoContent;
}
return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => {
if (completions.isMemberCompletion || entry.name.indexOf(prefix) == 0) {
result.push(entry);
}
return result;
}, []);
}
getCompletionEntryDetails(line: number, col: number,
entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
return entryNames.reduce((accum: protocol.CompletionEntryDetails[], entryName: string) => {
var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName);
if (details) {
accum.push(details);
}
return accum;
}, []);
}
getDiagnostics(delay: number, fileNames: string[]) {
var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => {
fileName = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(fileName);
if (project) {
accum.push({ fileName, project });
}
return accum;
}, []);
if (checkList.length > 0) {
this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay)
}
}
change(line: number, col: number, endLine: number, endCol: number, insertString: string, fileName: string) {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (project) {
var compilerService = project.compilerService;
var start = compilerService.host.lineColToPosition(file, line, col);
var end = compilerService.host.lineColToPosition(file, endLine, endCol);
if (start >= 0) {
compilerService.host.editScript(file, start, end, insertString);
this.changeSeq++;
}
}
}
reload(fileName: string, tempFileName: string, reqSeq = 0) {
var file = ts.normalizePath(fileName);
var tmpfile = ts.normalizePath(tempFileName);
var project = this.projectService.getProjectForFile(file);
if (project) {
this.changeSeq++;
// make sure no changes happen before this one is finished
project.compilerService.host.reloadScript(file, tmpfile,() => {
this.output(undefined, CommandNames.Reload, reqSeq);
});
}
}
saveToTmp(fileName: string, tempFileName: string) {
var file = ts.normalizePath(fileName);
var tmpfile = ts.normalizePath(tempFileName);
var project = this.projectService.getProjectForFile(file);
if (project) {
project.compilerService.host.saveTo(file, tmpfile);
}
}
closeClientFile(fileName: string) {
var file = ts.normalizePath(fileName);
this.projectService.closeClientFile(file);
}
decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): protocol.NavigationBarItem[] {
if (!items) {
return undefined;
}
var compilerService = project.compilerService;
return items.map(item => ({
text: item.text,
kind: item.kind,
kindModifiers: item.kindModifiers,
spans: item.spans.map(span => ({
start: compilerService.host.positionToLineCol(fileName, span.start),
end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span))
})),
childItems: this.decorateNavigationBarItem(project, fileName, item.childItems)
}));
}
getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var items = compilerService.languageService.getNavigationBarItems(file);
if (!items) {
throw Errors.NoContent;
}
return this.decorateNavigationBarItem(project, fileName, items);
}
getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm));
if (!navItems) {
throw Errors.NoContent;
}
return navItems.map((navItem) => {
var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start);
var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan));
var bakedItem: protocol.NavtoItem = {
name: navItem.name,
kind: navItem.kind,
file: navItem.fileName,
start: start,
end: end,
};
if (navItem.kindModifiers && (navItem.kindModifiers != "")) {
bakedItem.kindModifiers = navItem.kindModifiers;
}
if (navItem.matchKind != 'none') {
bakedItem.matchKind = navItem.matchKind;
}
if (navItem.containerName && (navItem.containerName.length > 0)) {
bakedItem.containerName = navItem.containerName;
}
if (navItem.containerKind && (navItem.containerKind.length > 0)) {
bakedItem.containerKind = navItem.containerKind;
}
return bakedItem;
});
}
getBraceMatching(line: number, col: number, fileName: string): protocol.TextSpan[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineColToPosition(file, line, col);
var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position);
if (!spans) {
throw Errors.NoContent;
}
return spans.map(span => ({
start: compilerService.host.positionToLineCol(file, span.start),
end: compilerService.host.positionToLineCol(file, span.start + span.length)
}));
}
onMessage(message: string) {
try {
var request = <protocol.Request>JSON.parse(message);
var response: any;
switch (request.command) {
case CommandNames.Definition: {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file);
break;
}
case CommandNames.References: {
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
response = this.getReferences(refArgs.line, refArgs.col, refArgs.file);
break;
}
case CommandNames.Rename: {
var renameArgs = <protocol.RenameRequestArgs>request.arguments;
response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
break;
}
case CommandNames.Open: {
var openArgs = <protocol.FileRequestArgs>request.arguments;
this.openClientFile(openArgs.file);
break;
}
case CommandNames.Quickinfo: {
var quickinfoArgs = <protocol.FileLocationRequestArgs>request.arguments;
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file);
break;
}
case CommandNames.Format: {
var formatArgs = <protocol.FormatRequestArgs>request.arguments;
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file);
break;
}
case CommandNames.Formatonkey: {
var formatOnKeyArgs = <protocol.FormatOnKeyRequestArgs>request.arguments;
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file);
break;
}
case CommandNames.Completions: {
var completionsArgs = <protocol.CompletionsRequestArgs>request.arguments;
response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file);
break;
}
case CommandNames.CompletionDetails: {
var completionDetailsArgs = <protocol.CompletionDetailsRequestArgs>request.arguments;
response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames,
request.arguments.file);
break;
}
case CommandNames.Geterr: {
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
break;
}
case CommandNames.Change: {
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol,
changeArgs.insertString, changeArgs.file);
break;
}
case CommandNames.Reload: {
var reloadArgs = <protocol.ReloadRequestArgs>request.arguments;
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
break;
}
case CommandNames.Saveto: {
var savetoArgs = <protocol.SavetoRequestArgs>request.arguments;
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
break;
}
case CommandNames.Close: {
var closeArgs = <protocol.FileRequestArgs>request.arguments;
this.closeClientFile(closeArgs.file);
break;
}
case CommandNames.Navto: {
var navtoArgs = <protocol.NavtoRequestArgs>request.arguments;
response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file);
break;
}
case CommandNames.Brace: {
var braceArguments = <protocol.FileLocationRequestArgs>request.arguments;
response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file);
break;
}
case CommandNames.NavBar: {
var navBarArgs = <protocol.FileRequestArgs>request.arguments;
response = this.getNavigationBarItems(navBarArgs.file);
break;
}
default: {
this.projectService.log("Unrecognized JSON command: " + message);
this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command);
break;
}
}
if (response) {
this.output(response, request.command, request.seq);
}
} catch (err) {
if (err instanceof OperationCanceledException) {
// Handle cancellation exceptions
}
this.logError(err, message);
this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message);
}
}
}
}
+5 -2
View File
@@ -151,8 +151,9 @@ module ts.BreakpointResolver {
return spanInForStatement(<ForStatement>node);
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
// span on for (a in ...)
return textSpan(node, findNextToken((<ForInStatement>node).expression, node));
return textSpan(node, findNextToken((<ForInStatement | ForOfStatement>node).expression, node));
case SyntaxKind.SwitchStatement:
// span on switch(...)
@@ -261,7 +262,8 @@ module ts.BreakpointResolver {
function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan {
// If declaration of for in statement, just set the span in parent
if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) {
if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement ||
variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
return spanInNode(variableDeclaration.parent.parent);
}
@@ -362,6 +364,7 @@ module ts.BreakpointResolver {
case SyntaxKind.WhileStatement:
case SyntaxKind.IfStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
+4
View File
@@ -464,6 +464,9 @@ module ts.formatting {
// "in" keyword in for (var x in []) { }
case SyntaxKind.ForInStatement:
return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword;
// Technically, "of" is not a binary operator, but format it the same way as "in"
case SyntaxKind.ForOfStatement:
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
}
return false;
}
@@ -592,6 +595,7 @@ module ts.formatting {
case SyntaxKind.SwitchStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.TryStatement:
case SyntaxKind.DoStatement:
+1
View File
@@ -358,6 +358,7 @@ module ts.formatting {
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.IfStatement:
case SyntaxKind.FunctionDeclaration:
+2 -2
View File
@@ -126,7 +126,7 @@ module ts.formatting {
static AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([SyntaxKind.MultiLineCommentTrivia]));
static Keywords = TokenRange.FromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword);
static BinaryOperators = TokenRange.FromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator);
static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword]);
static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword]);
static UnaryPrefixOperators = TokenRange.FromTokens([SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken]);
static UnaryPrefixExpressions = TokenRange.FromTokens([SyntaxKind.NumericLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.OpenBraceToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]);
static UnaryPreincrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]);
@@ -134,7 +134,7 @@ module ts.formatting {
static UnaryPredecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]);
static UnaryPostdecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.NewKeyword]);
static Comments = TokenRange.FromTokens([SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia]);
static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]);
static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]);
}
}
}
+105
View File
@@ -0,0 +1,105 @@
module ts.NavigateTo {
type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration };
enum MatchKind {
none = 0,
exact = 1,
substring = 2,
prefix = 3
}
export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{
// Split search value in terms array
var terms = searchValue.split(" ");
// default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version
var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }));
var rawItems: RawNavigateToItem[] = [];
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
forEach(program.getSourceFiles(), sourceFile => {
cancellationToken.throwIfCancellationRequested();
var fileName = sourceFile.fileName;
var declarations = sourceFile.getNamedDeclarations();
for (var i = 0, n = declarations.length; i < n; i++) {
var declaration = declarations[i];
// TODO(jfreeman): Skip this declaration if it has a computed name
var name = (<Identifier>declaration.name).text;
var matchKind = getMatchKind(searchTerms, name);
if (matchKind !== MatchKind.none) {
rawItems.push({ name, fileName, matchKind, declaration });
}
}
});
rawItems.sort((i1, i2) => i1.matchKind - i2.matchKind);
if (maxResultCount !== undefined) {
rawItems = rawItems.slice(0, maxResultCount);
}
var items = map(rawItems, createNavigateToItem);
return items;
function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem {
var declaration = rawItem.declaration;
var container = <Declaration>getContainerNode(declaration);
return {
name: rawItem.name,
kind: getNodeKind(declaration),
kindModifiers: getNodeModifiers(declaration),
matchKind: MatchKind[rawItem.matchKind],
fileName: rawItem.fileName,
textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
// TODO(jfreeman): What should be the containerName when the container has a computed name?
containerName: container && container.name ? (<Identifier>container.name).text : "",
containerKind: container && container.name ? getNodeKind(container) : ""
};
}
function hasAnyUpperCaseCharacter(s: string): boolean {
for (var i = 0, n = s.length; i < n; i++) {
var c = s.charCodeAt(i);
if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) ||
(c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) {
return true;
}
}
return false;
}
function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind {
var matchKind = MatchKind.none;
if (name) {
for (var j = 0, n = searchTerms.length; j < n; j++) {
var searchTerm = searchTerms[j];
var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase();
// in case of case-insensitive search searchTerm.term will already be lower-cased
var index = nameToSearch.indexOf(searchTerm.term);
if (index < 0) {
// Didn't match.
return MatchKind.none;
}
var termKind = MatchKind.substring;
if (index === 0) {
// here we know that match occur at the beginning of the string.
// if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match
termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix;
}
// Update our match kind if we don't have one, or if this match is better.
if (matchKind === MatchKind.none || termKind < matchKind) {
matchKind = termKind;
}
}
}
return matchKind;
}
}
}
+11 -5
View File
@@ -97,8 +97,7 @@ module ts.NavigationBar {
function sortNodes(nodes: Node[]): Node[] {
return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => {
if (n1.name && n2.name) {
// TODO(jfreeman): How do we sort declarations with computed names?
return (<Identifier>n1.name).text.localeCompare((<Identifier>n2.name).text);
return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name));
}
else if (n1.name) {
return 1;
@@ -426,7 +425,7 @@ module ts.NavigationBar {
// Add the constructor parameters in as children of the class (for property parameters).
// Note that *all* parameters will be added to the nodes array, but parameters that
// are not properties will be filtered out later by createChildItem.
var nodes: Node[] = removeComputedProperties(node);
var nodes: Node[] = removeDynamicallyNamedProperties(node);
if (constructor) {
nodes.push.apply(nodes, constructor.parameters);
}
@@ -455,7 +454,7 @@ module ts.NavigationBar {
}
function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem);
var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem);
return getNavigationBarItem(
node.name.text,
ts.ScriptElementKind.interfaceElement,
@@ -466,10 +465,17 @@ module ts.NavigationBar {
}
}
function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] {
function removeComputedProperties(node: EnumDeclaration): Declaration[] {
return filter<Declaration>(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName);
}
/**
* Like removeComputedProperties, but retains the properties with well known symbol names
*/
function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{
return filter<Declaration>(node.members, member => !hasDynamicName(member));
}
function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration {
while (node.body.kind === SyntaxKind.ModuleDeclaration) {
node = <ModuleDeclaration>node.body;
@@ -61,6 +61,7 @@ module ts {
// to be the entire span of the parent.
if (parent.kind === SyntaxKind.DoStatement ||
parent.kind === SyntaxKind.ForInStatement ||
parent.kind === SyntaxKind.ForOfStatement ||
parent.kind === SyntaxKind.ForStatement ||
parent.kind === SyntaxKind.IfStatement ||
parent.kind === SyntaxKind.WhileStatement ||
+75 -156
View File
@@ -2,6 +2,7 @@
/// <reference path='breakpoints.ts' />
/// <reference path='outliningElementsCollector.ts' />
/// <reference path='navigateTo.ts' />
/// <reference path='navigationBar.ts' />
/// <reference path='signatureHelp.ts' />
/// <reference path='utilities.ts' />
@@ -900,7 +901,7 @@ module ts {
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
@@ -991,6 +992,7 @@ module ts {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number| string;
}
export interface DefinitionInfo {
@@ -1377,13 +1379,6 @@ module ts {
public static typeAlias = "type alias name";
}
enum MatchKind {
none = 0,
exact = 1,
substring = 2,
prefix = 3
}
/// Language Service
interface CompletionSession {
@@ -1991,6 +1986,62 @@ module ts {
});
}
/* @internal */ export function getContainerNode(node: Node): Node {
while (true) {
node = node.parent;
if (!node) {
return undefined;
}
switch (node.kind) {
case SyntaxKind.SourceFile:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
return node;
}
}
}
/* @internal */ export function getNodeKind(node: Node): string {
switch (node.kind) {
case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement;
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement;
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
case SyntaxKind.VariableDeclaration:
return isConst(node)
? ScriptElementKind.constElement
: isLet(node)
? ScriptElementKind.letElement
: ScriptElementKind.variableElement;
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
return ScriptElementKind.memberFunctionElement;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
return ScriptElementKind.memberVariableElement;
case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement;
case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement;
case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement;
case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement;
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
}
return ScriptElementKind.unknown;
}
export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService {
var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host);
var ruleProvider: formatting.RulesProvider;
@@ -2721,29 +2772,6 @@ module ts {
}
}
function getContainerNode(node: Node): Node {
while (true) {
node = node.parent;
if (!node) {
return undefined;
}
switch (node.kind) {
case SyntaxKind.SourceFile:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
return node;
}
}
}
// TODO(drosen): use contextual SemanticMeaning.
function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string {
var flags = symbol.getFlags();
@@ -2830,39 +2858,6 @@ module ts {
return ScriptElementKind.unknown;
}
function getNodeKind(node: Node): string {
switch (node.kind) {
case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement;
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement;
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
case SyntaxKind.VariableDeclaration:
return isConst(node)
? ScriptElementKind.constElement
: isLet(node)
? ScriptElementKind.letElement
: ScriptElementKind.variableElement;
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
return ScriptElementKind.memberFunctionElement;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
return ScriptElementKind.memberVariableElement;
case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement;
case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement;
case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement;
case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement;
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
}
return ScriptElementKind.unknown;
}
function getSymbolModifiers(symbol: Symbol): string {
return symbol && symbol.declarations && symbol.declarations.length > 0
? getNodeModifiers(symbol.declarations[0])
@@ -3441,7 +3436,9 @@ module ts {
}
break;
case SyntaxKind.ForKeyword:
if (hasKind(node.parent, SyntaxKind.ForStatement) || hasKind(node.parent, SyntaxKind.ForInStatement)) {
if (hasKind(node.parent, SyntaxKind.ForStatement) ||
hasKind(node.parent, SyntaxKind.ForInStatement) ||
hasKind(node.parent, SyntaxKind.ForOfStatement)) {
return getLoopBreakContinueOccurrences(<IterationStatement>node.parent);
}
break;
@@ -3718,6 +3715,7 @@ module ts {
switch (owner.kind) {
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
return getLoopBreakContinueOccurrences(<IterationStatement>owner)
@@ -3762,6 +3760,7 @@ module ts {
// Fall through.
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
case SyntaxKind.ForOfStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.DoStatement:
if (!statement.label || isLabeledBy(node, statement.label.text)) {
@@ -4658,89 +4657,10 @@ module ts {
}
/// NavigateTo
function getNavigateToItems(searchValue: string): NavigateToItem[] {
function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] {
synchronizeHostData();
// Split search value in terms array
var terms = searchValue.split(" ");
// default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version
var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }));
var items: NavigateToItem[] = [];
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
forEach(program.getSourceFiles(), sourceFile => {
cancellationToken.throwIfCancellationRequested();
var fileName = sourceFile.fileName;
var declarations = sourceFile.getNamedDeclarations();
for (var i = 0, n = declarations.length; i < n; i++) {
var declaration = declarations[i];
// TODO(jfreeman): Skip this declaration if it has a computed name
var name = (<Identifier>declaration.name).text;
var matchKind = getMatchKind(searchTerms, name);
if (matchKind !== MatchKind.none) {
var container = <Declaration>getContainerNode(declaration);
items.push({
name: name,
kind: getNodeKind(declaration),
kindModifiers: getNodeModifiers(declaration),
matchKind: MatchKind[matchKind],
fileName: fileName,
textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
// TODO(jfreeman): What should be the containerName when the container has a computed name?
containerName: container && container.name ? (<Identifier>container.name).text : "",
containerKind: container && container.name ? getNodeKind(container) : ""
});
}
}
});
return items;
function hasAnyUpperCaseCharacter(s: string): boolean {
for (var i = 0, n = s.length; i < n; i++) {
var c = s.charCodeAt(i);
if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) ||
(c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) {
return true;
}
}
return false;
}
function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind {
var matchKind = MatchKind.none;
if (name) {
for (var j = 0, n = searchTerms.length; j < n; j++) {
var searchTerm = searchTerms[j];
var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase();
// in case of case-insensitive search searchTerm.term will already be lower-cased
var index = nameToSearch.indexOf(searchTerm.term);
if (index < 0) {
// Didn't match.
return MatchKind.none;
}
var termKind = MatchKind.substring;
if (index === 0) {
// here we know that match occur at the beginning of the string.
// if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match
termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix;
}
// Update our match kind if we don't have one, or if this match is better.
if (matchKind === MatchKind.none || termKind < matchKind) {
matchKind = termKind;
}
}
}
return matchKind;
}
return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount);
}
function containErrors(diagnostics: Diagnostic[]): boolean {
@@ -5540,11 +5460,13 @@ module ts {
var declarations = symbol.getDeclarations();
if (declarations && declarations.length > 0) {
// Disallow rename for elements that are defined in the standard TypeScript library.
var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings());
for (var i = 0; i < declarations.length; i++) {
var sourceFile = declarations[i].getSourceFile();
if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
if (defaultLibFileName) {
for (var i = 0; i < declarations.length; i++) {
var sourceFile = declarations[i].getSourceFile();
if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
}
}
}
@@ -5566,10 +5488,6 @@ module ts {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key));
function endsWith(string: string, value: string): boolean {
return string.lastIndexOf(value) + value.length === string.length;
}
function getRenameInfoError(localizedErrorMessage: string): RenameInfo {
return {
canRename: false,
@@ -5799,7 +5717,8 @@ module ts {
else if (token === SyntaxKind.AnyKeyword ||
token === SyntaxKind.StringKeyword ||
token === SyntaxKind.NumberKeyword ||
token === SyntaxKind.BooleanKeyword) {
token === SyntaxKind.BooleanKeyword ||
token === SyntaxKind.SymbolKeyword) {
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
+5 -8
View File
@@ -138,7 +138,7 @@ module ts {
* Returns a JSON-encoded value of the type:
* { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = [];
*/
getNavigateToItems(searchValue: string): string;
getNavigateToItems(searchValue: string, maxResultCount?: number): string;
/**
* Returns a JSON-encoded value of the type:
@@ -274,10 +274,7 @@ module ts {
}
public getDefaultLibFileName(options: CompilerOptions): string {
// Shim the API changes for 1.5 release. This should be removed once
// TypeScript 1.5 has shipped.
return "";
//return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
}
}
@@ -631,11 +628,11 @@ module ts {
/// NAVIGATE TO
/** Return a list of symbols that are interesting to navigate to */
public getNavigateToItems(searchValue: string): string {
public getNavigateToItems(searchValue: string, maxResultCount?: number): string {
return this.forwardJSONCall(
"getNavigateToItems('" + searchValue + "')",
"getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")",
() => {
var items = this.languageService.getNavigateToItems(searchValue);
var items = this.languageService.getNavigateToItems(searchValue, maxResultCount);
return items;
});
}
+107 -98
View File
@@ -179,110 +179,113 @@ declare module "typescript" {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -291,7 +294,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -622,6 +625,10 @@ declare module "typescript" {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -1031,8 +1038,9 @@ declare module "typescript" {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1533,7 +1541,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1608,6 +1616,7 @@ declare module "typescript" {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
+128 -99
View File
@@ -555,274 +555,283 @@ declare module "typescript" {
StringKeyword = 119,
>StringKeyword : SyntaxKind
TypeKeyword = 120,
SymbolKeyword = 120,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
>TypeKeyword : SyntaxKind
QualifiedName = 121,
OfKeyword = 122,
>OfKeyword : SyntaxKind
QualifiedName = 123,
>QualifiedName : SyntaxKind
ComputedPropertyName = 122,
ComputedPropertyName = 124,
>ComputedPropertyName : SyntaxKind
TypeParameter = 123,
TypeParameter = 125,
>TypeParameter : SyntaxKind
Parameter = 124,
Parameter = 126,
>Parameter : SyntaxKind
PropertySignature = 125,
PropertySignature = 127,
>PropertySignature : SyntaxKind
PropertyDeclaration = 126,
PropertyDeclaration = 128,
>PropertyDeclaration : SyntaxKind
MethodSignature = 127,
MethodSignature = 129,
>MethodSignature : SyntaxKind
MethodDeclaration = 128,
MethodDeclaration = 130,
>MethodDeclaration : SyntaxKind
Constructor = 129,
Constructor = 131,
>Constructor : SyntaxKind
GetAccessor = 130,
GetAccessor = 132,
>GetAccessor : SyntaxKind
SetAccessor = 131,
SetAccessor = 133,
>SetAccessor : SyntaxKind
CallSignature = 132,
CallSignature = 134,
>CallSignature : SyntaxKind
ConstructSignature = 133,
ConstructSignature = 135,
>ConstructSignature : SyntaxKind
IndexSignature = 134,
IndexSignature = 136,
>IndexSignature : SyntaxKind
TypeReference = 135,
TypeReference = 137,
>TypeReference : SyntaxKind
FunctionType = 136,
FunctionType = 138,
>FunctionType : SyntaxKind
ConstructorType = 137,
ConstructorType = 139,
>ConstructorType : SyntaxKind
TypeQuery = 138,
TypeQuery = 140,
>TypeQuery : SyntaxKind
TypeLiteral = 139,
TypeLiteral = 141,
>TypeLiteral : SyntaxKind
ArrayType = 140,
ArrayType = 142,
>ArrayType : SyntaxKind
TupleType = 141,
TupleType = 143,
>TupleType : SyntaxKind
UnionType = 142,
UnionType = 144,
>UnionType : SyntaxKind
ParenthesizedType = 143,
ParenthesizedType = 145,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 144,
ObjectBindingPattern = 146,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 145,
ArrayBindingPattern = 147,
>ArrayBindingPattern : SyntaxKind
BindingElement = 146,
BindingElement = 148,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 147,
ArrayLiteralExpression = 149,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 148,
ObjectLiteralExpression = 150,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 149,
PropertyAccessExpression = 151,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 150,
ElementAccessExpression = 152,
>ElementAccessExpression : SyntaxKind
CallExpression = 151,
CallExpression = 153,
>CallExpression : SyntaxKind
NewExpression = 152,
NewExpression = 154,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 153,
TaggedTemplateExpression = 155,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 154,
TypeAssertionExpression = 156,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 155,
ParenthesizedExpression = 157,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 156,
FunctionExpression = 158,
>FunctionExpression : SyntaxKind
ArrowFunction = 157,
ArrowFunction = 159,
>ArrowFunction : SyntaxKind
DeleteExpression = 158,
DeleteExpression = 160,
>DeleteExpression : SyntaxKind
TypeOfExpression = 159,
TypeOfExpression = 161,
>TypeOfExpression : SyntaxKind
VoidExpression = 160,
VoidExpression = 162,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 161,
PrefixUnaryExpression = 163,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 162,
PostfixUnaryExpression = 164,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 163,
BinaryExpression = 165,
>BinaryExpression : SyntaxKind
ConditionalExpression = 164,
ConditionalExpression = 166,
>ConditionalExpression : SyntaxKind
TemplateExpression = 165,
TemplateExpression = 167,
>TemplateExpression : SyntaxKind
YieldExpression = 166,
YieldExpression = 168,
>YieldExpression : SyntaxKind
SpreadElementExpression = 167,
SpreadElementExpression = 169,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 168,
OmittedExpression = 170,
>OmittedExpression : SyntaxKind
TemplateSpan = 169,
TemplateSpan = 171,
>TemplateSpan : SyntaxKind
Block = 170,
Block = 172,
>Block : SyntaxKind
VariableStatement = 171,
VariableStatement = 173,
>VariableStatement : SyntaxKind
EmptyStatement = 172,
EmptyStatement = 174,
>EmptyStatement : SyntaxKind
ExpressionStatement = 173,
ExpressionStatement = 175,
>ExpressionStatement : SyntaxKind
IfStatement = 174,
IfStatement = 176,
>IfStatement : SyntaxKind
DoStatement = 175,
DoStatement = 177,
>DoStatement : SyntaxKind
WhileStatement = 176,
WhileStatement = 178,
>WhileStatement : SyntaxKind
ForStatement = 177,
ForStatement = 179,
>ForStatement : SyntaxKind
ForInStatement = 178,
ForInStatement = 180,
>ForInStatement : SyntaxKind
ContinueStatement = 179,
ForOfStatement = 181,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
>ContinueStatement : SyntaxKind
BreakStatement = 180,
BreakStatement = 183,
>BreakStatement : SyntaxKind
ReturnStatement = 181,
ReturnStatement = 184,
>ReturnStatement : SyntaxKind
WithStatement = 182,
WithStatement = 185,
>WithStatement : SyntaxKind
SwitchStatement = 183,
SwitchStatement = 186,
>SwitchStatement : SyntaxKind
LabeledStatement = 184,
LabeledStatement = 187,
>LabeledStatement : SyntaxKind
ThrowStatement = 185,
ThrowStatement = 188,
>ThrowStatement : SyntaxKind
TryStatement = 186,
TryStatement = 189,
>TryStatement : SyntaxKind
DebuggerStatement = 187,
DebuggerStatement = 190,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 188,
VariableDeclaration = 191,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 189,
VariableDeclarationList = 192,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 190,
FunctionDeclaration = 193,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 191,
ClassDeclaration = 194,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 192,
InterfaceDeclaration = 195,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 193,
TypeAliasDeclaration = 196,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 194,
EnumDeclaration = 197,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 195,
ModuleDeclaration = 198,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 196,
ModuleBlock = 199,
>ModuleBlock : SyntaxKind
ImportDeclaration = 197,
ImportDeclaration = 200,
>ImportDeclaration : SyntaxKind
ExportAssignment = 198,
ExportAssignment = 201,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 199,
ExternalModuleReference = 202,
>ExternalModuleReference : SyntaxKind
CaseClause = 200,
CaseClause = 203,
>CaseClause : SyntaxKind
DefaultClause = 201,
DefaultClause = 204,
>DefaultClause : SyntaxKind
HeritageClause = 202,
HeritageClause = 205,
>HeritageClause : SyntaxKind
CatchClause = 203,
CatchClause = 206,
>CatchClause : SyntaxKind
PropertyAssignment = 204,
PropertyAssignment = 207,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 205,
ShorthandPropertyAssignment = 208,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 206,
EnumMember = 209,
>EnumMember : SyntaxKind
SourceFile = 207,
SourceFile = 210,
>SourceFile : SyntaxKind
SyntaxList = 208,
SyntaxList = 211,
>SyntaxList : SyntaxKind
Count = 209,
Count = 212,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -840,7 +849,7 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 120,
LastKeyword = 122,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
@@ -849,10 +858,10 @@ declare module "typescript" {
LastFutureReservedWord = 109,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 135,
FirstTypeNode = 137,
>FirstTypeNode : SyntaxKind
LastTypeNode = 143,
LastTypeNode = 145,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -864,7 +873,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 120,
LastToken = 122,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -891,7 +900,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 121,
FirstNode = 123,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1872,6 +1881,19 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface ForOfStatement extends IterationStatement {
>ForOfStatement : ForOfStatement
>IterationStatement : IterationStatement
initializer: VariableDeclarationList | Expression;
>initializer : Expression | VariableDeclarationList
>VariableDeclarationList : VariableDeclarationList
>Expression : Expression
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface BreakOrContinueStatement extends Statement {
@@ -3320,10 +3342,13 @@ declare module "typescript" {
ContainsObjectLiteral = 524288,
>ContainsObjectLiteral : TypeFlags
Intrinsic = 127,
ESSymbol = 1048576,
>ESSymbol : TypeFlags
Intrinsic = 1048703,
>Intrinsic : TypeFlags
Primitive = 510,
Primitive = 1049086,
>Primitive : TypeFlags
StringLike = 258,
@@ -4963,9 +4988,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
@@ -5204,6 +5230,9 @@ declare module "typescript" {
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
[s: string]: boolean | number | string;
>s : string
}
interface DefinitionInfo {
>DefinitionInfo : DefinitionInfo
+116 -107
View File
@@ -210,110 +210,113 @@ declare module "typescript" {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -322,7 +325,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -653,6 +656,10 @@ declare module "typescript" {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -1062,8 +1069,9 @@ declare module "typescript" {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1564,7 +1572,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1639,6 +1647,7 @@ declare module "typescript" {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
@@ -1976,24 +1985,24 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 177 /* ForStatement */:
case 178 /* ForInStatement */:
case 176 /* WhileStatement */:
case 175 /* DoStatement */:
if (node.statement.kind !== 170 /* Block */) {
case 179 /* ForStatement */:
case 180 /* ForInStatement */:
case 178 /* WhileStatement */:
case 177 /* DoStatement */:
if (node.statement.kind !== 172 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 174 /* IfStatement */:
case 176 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 170 /* Block */) {
if (ifStatement.thenStatement.kind !== 172 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) {
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 163 /* BinaryExpression */:
case 165 /* BinaryExpression */:
var op = node.operator;
if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
+128 -99
View File
@@ -699,274 +699,283 @@ declare module "typescript" {
StringKeyword = 119,
>StringKeyword : SyntaxKind
TypeKeyword = 120,
SymbolKeyword = 120,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
>TypeKeyword : SyntaxKind
QualifiedName = 121,
OfKeyword = 122,
>OfKeyword : SyntaxKind
QualifiedName = 123,
>QualifiedName : SyntaxKind
ComputedPropertyName = 122,
ComputedPropertyName = 124,
>ComputedPropertyName : SyntaxKind
TypeParameter = 123,
TypeParameter = 125,
>TypeParameter : SyntaxKind
Parameter = 124,
Parameter = 126,
>Parameter : SyntaxKind
PropertySignature = 125,
PropertySignature = 127,
>PropertySignature : SyntaxKind
PropertyDeclaration = 126,
PropertyDeclaration = 128,
>PropertyDeclaration : SyntaxKind
MethodSignature = 127,
MethodSignature = 129,
>MethodSignature : SyntaxKind
MethodDeclaration = 128,
MethodDeclaration = 130,
>MethodDeclaration : SyntaxKind
Constructor = 129,
Constructor = 131,
>Constructor : SyntaxKind
GetAccessor = 130,
GetAccessor = 132,
>GetAccessor : SyntaxKind
SetAccessor = 131,
SetAccessor = 133,
>SetAccessor : SyntaxKind
CallSignature = 132,
CallSignature = 134,
>CallSignature : SyntaxKind
ConstructSignature = 133,
ConstructSignature = 135,
>ConstructSignature : SyntaxKind
IndexSignature = 134,
IndexSignature = 136,
>IndexSignature : SyntaxKind
TypeReference = 135,
TypeReference = 137,
>TypeReference : SyntaxKind
FunctionType = 136,
FunctionType = 138,
>FunctionType : SyntaxKind
ConstructorType = 137,
ConstructorType = 139,
>ConstructorType : SyntaxKind
TypeQuery = 138,
TypeQuery = 140,
>TypeQuery : SyntaxKind
TypeLiteral = 139,
TypeLiteral = 141,
>TypeLiteral : SyntaxKind
ArrayType = 140,
ArrayType = 142,
>ArrayType : SyntaxKind
TupleType = 141,
TupleType = 143,
>TupleType : SyntaxKind
UnionType = 142,
UnionType = 144,
>UnionType : SyntaxKind
ParenthesizedType = 143,
ParenthesizedType = 145,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 144,
ObjectBindingPattern = 146,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 145,
ArrayBindingPattern = 147,
>ArrayBindingPattern : SyntaxKind
BindingElement = 146,
BindingElement = 148,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 147,
ArrayLiteralExpression = 149,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 148,
ObjectLiteralExpression = 150,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 149,
PropertyAccessExpression = 151,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 150,
ElementAccessExpression = 152,
>ElementAccessExpression : SyntaxKind
CallExpression = 151,
CallExpression = 153,
>CallExpression : SyntaxKind
NewExpression = 152,
NewExpression = 154,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 153,
TaggedTemplateExpression = 155,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 154,
TypeAssertionExpression = 156,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 155,
ParenthesizedExpression = 157,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 156,
FunctionExpression = 158,
>FunctionExpression : SyntaxKind
ArrowFunction = 157,
ArrowFunction = 159,
>ArrowFunction : SyntaxKind
DeleteExpression = 158,
DeleteExpression = 160,
>DeleteExpression : SyntaxKind
TypeOfExpression = 159,
TypeOfExpression = 161,
>TypeOfExpression : SyntaxKind
VoidExpression = 160,
VoidExpression = 162,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 161,
PrefixUnaryExpression = 163,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 162,
PostfixUnaryExpression = 164,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 163,
BinaryExpression = 165,
>BinaryExpression : SyntaxKind
ConditionalExpression = 164,
ConditionalExpression = 166,
>ConditionalExpression : SyntaxKind
TemplateExpression = 165,
TemplateExpression = 167,
>TemplateExpression : SyntaxKind
YieldExpression = 166,
YieldExpression = 168,
>YieldExpression : SyntaxKind
SpreadElementExpression = 167,
SpreadElementExpression = 169,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 168,
OmittedExpression = 170,
>OmittedExpression : SyntaxKind
TemplateSpan = 169,
TemplateSpan = 171,
>TemplateSpan : SyntaxKind
Block = 170,
Block = 172,
>Block : SyntaxKind
VariableStatement = 171,
VariableStatement = 173,
>VariableStatement : SyntaxKind
EmptyStatement = 172,
EmptyStatement = 174,
>EmptyStatement : SyntaxKind
ExpressionStatement = 173,
ExpressionStatement = 175,
>ExpressionStatement : SyntaxKind
IfStatement = 174,
IfStatement = 176,
>IfStatement : SyntaxKind
DoStatement = 175,
DoStatement = 177,
>DoStatement : SyntaxKind
WhileStatement = 176,
WhileStatement = 178,
>WhileStatement : SyntaxKind
ForStatement = 177,
ForStatement = 179,
>ForStatement : SyntaxKind
ForInStatement = 178,
ForInStatement = 180,
>ForInStatement : SyntaxKind
ContinueStatement = 179,
ForOfStatement = 181,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
>ContinueStatement : SyntaxKind
BreakStatement = 180,
BreakStatement = 183,
>BreakStatement : SyntaxKind
ReturnStatement = 181,
ReturnStatement = 184,
>ReturnStatement : SyntaxKind
WithStatement = 182,
WithStatement = 185,
>WithStatement : SyntaxKind
SwitchStatement = 183,
SwitchStatement = 186,
>SwitchStatement : SyntaxKind
LabeledStatement = 184,
LabeledStatement = 187,
>LabeledStatement : SyntaxKind
ThrowStatement = 185,
ThrowStatement = 188,
>ThrowStatement : SyntaxKind
TryStatement = 186,
TryStatement = 189,
>TryStatement : SyntaxKind
DebuggerStatement = 187,
DebuggerStatement = 190,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 188,
VariableDeclaration = 191,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 189,
VariableDeclarationList = 192,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 190,
FunctionDeclaration = 193,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 191,
ClassDeclaration = 194,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 192,
InterfaceDeclaration = 195,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 193,
TypeAliasDeclaration = 196,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 194,
EnumDeclaration = 197,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 195,
ModuleDeclaration = 198,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 196,
ModuleBlock = 199,
>ModuleBlock : SyntaxKind
ImportDeclaration = 197,
ImportDeclaration = 200,
>ImportDeclaration : SyntaxKind
ExportAssignment = 198,
ExportAssignment = 201,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 199,
ExternalModuleReference = 202,
>ExternalModuleReference : SyntaxKind
CaseClause = 200,
CaseClause = 203,
>CaseClause : SyntaxKind
DefaultClause = 201,
DefaultClause = 204,
>DefaultClause : SyntaxKind
HeritageClause = 202,
HeritageClause = 205,
>HeritageClause : SyntaxKind
CatchClause = 203,
CatchClause = 206,
>CatchClause : SyntaxKind
PropertyAssignment = 204,
PropertyAssignment = 207,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 205,
ShorthandPropertyAssignment = 208,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 206,
EnumMember = 209,
>EnumMember : SyntaxKind
SourceFile = 207,
SourceFile = 210,
>SourceFile : SyntaxKind
SyntaxList = 208,
SyntaxList = 211,
>SyntaxList : SyntaxKind
Count = 209,
Count = 212,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -984,7 +993,7 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 120,
LastKeyword = 122,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
@@ -993,10 +1002,10 @@ declare module "typescript" {
LastFutureReservedWord = 109,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 135,
FirstTypeNode = 137,
>FirstTypeNode : SyntaxKind
LastTypeNode = 143,
LastTypeNode = 145,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -1008,7 +1017,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 120,
LastToken = 122,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1035,7 +1044,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 121,
FirstNode = 123,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -2016,6 +2025,19 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface ForOfStatement extends IterationStatement {
>ForOfStatement : ForOfStatement
>IterationStatement : IterationStatement
initializer: VariableDeclarationList | Expression;
>initializer : Expression | VariableDeclarationList
>VariableDeclarationList : VariableDeclarationList
>Expression : Expression
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface BreakOrContinueStatement extends Statement {
@@ -3464,10 +3486,13 @@ declare module "typescript" {
ContainsObjectLiteral = 524288,
>ContainsObjectLiteral : TypeFlags
Intrinsic = 127,
ESSymbol = 1048576,
>ESSymbol : TypeFlags
Intrinsic = 1048703,
>Intrinsic : TypeFlags
Primitive = 510,
Primitive = 1049086,
>Primitive : TypeFlags
StringLike = 258,
@@ -5107,9 +5132,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
@@ -5348,6 +5374,9 @@ declare module "typescript" {
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
[s: string]: boolean | number | string;
>s : string
}
interface DefinitionInfo {
>DefinitionInfo : DefinitionInfo
+107 -98
View File
@@ -211,110 +211,113 @@ declare module "typescript" {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -323,7 +326,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -654,6 +657,10 @@ declare module "typescript" {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -1063,8 +1070,9 @@ declare module "typescript" {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1565,7 +1573,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1640,6 +1648,7 @@ declare module "typescript" {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
@@ -651,274 +651,283 @@ declare module "typescript" {
StringKeyword = 119,
>StringKeyword : SyntaxKind
TypeKeyword = 120,
SymbolKeyword = 120,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
>TypeKeyword : SyntaxKind
QualifiedName = 121,
OfKeyword = 122,
>OfKeyword : SyntaxKind
QualifiedName = 123,
>QualifiedName : SyntaxKind
ComputedPropertyName = 122,
ComputedPropertyName = 124,
>ComputedPropertyName : SyntaxKind
TypeParameter = 123,
TypeParameter = 125,
>TypeParameter : SyntaxKind
Parameter = 124,
Parameter = 126,
>Parameter : SyntaxKind
PropertySignature = 125,
PropertySignature = 127,
>PropertySignature : SyntaxKind
PropertyDeclaration = 126,
PropertyDeclaration = 128,
>PropertyDeclaration : SyntaxKind
MethodSignature = 127,
MethodSignature = 129,
>MethodSignature : SyntaxKind
MethodDeclaration = 128,
MethodDeclaration = 130,
>MethodDeclaration : SyntaxKind
Constructor = 129,
Constructor = 131,
>Constructor : SyntaxKind
GetAccessor = 130,
GetAccessor = 132,
>GetAccessor : SyntaxKind
SetAccessor = 131,
SetAccessor = 133,
>SetAccessor : SyntaxKind
CallSignature = 132,
CallSignature = 134,
>CallSignature : SyntaxKind
ConstructSignature = 133,
ConstructSignature = 135,
>ConstructSignature : SyntaxKind
IndexSignature = 134,
IndexSignature = 136,
>IndexSignature : SyntaxKind
TypeReference = 135,
TypeReference = 137,
>TypeReference : SyntaxKind
FunctionType = 136,
FunctionType = 138,
>FunctionType : SyntaxKind
ConstructorType = 137,
ConstructorType = 139,
>ConstructorType : SyntaxKind
TypeQuery = 138,
TypeQuery = 140,
>TypeQuery : SyntaxKind
TypeLiteral = 139,
TypeLiteral = 141,
>TypeLiteral : SyntaxKind
ArrayType = 140,
ArrayType = 142,
>ArrayType : SyntaxKind
TupleType = 141,
TupleType = 143,
>TupleType : SyntaxKind
UnionType = 142,
UnionType = 144,
>UnionType : SyntaxKind
ParenthesizedType = 143,
ParenthesizedType = 145,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 144,
ObjectBindingPattern = 146,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 145,
ArrayBindingPattern = 147,
>ArrayBindingPattern : SyntaxKind
BindingElement = 146,
BindingElement = 148,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 147,
ArrayLiteralExpression = 149,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 148,
ObjectLiteralExpression = 150,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 149,
PropertyAccessExpression = 151,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 150,
ElementAccessExpression = 152,
>ElementAccessExpression : SyntaxKind
CallExpression = 151,
CallExpression = 153,
>CallExpression : SyntaxKind
NewExpression = 152,
NewExpression = 154,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 153,
TaggedTemplateExpression = 155,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 154,
TypeAssertionExpression = 156,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 155,
ParenthesizedExpression = 157,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 156,
FunctionExpression = 158,
>FunctionExpression : SyntaxKind
ArrowFunction = 157,
ArrowFunction = 159,
>ArrowFunction : SyntaxKind
DeleteExpression = 158,
DeleteExpression = 160,
>DeleteExpression : SyntaxKind
TypeOfExpression = 159,
TypeOfExpression = 161,
>TypeOfExpression : SyntaxKind
VoidExpression = 160,
VoidExpression = 162,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 161,
PrefixUnaryExpression = 163,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 162,
PostfixUnaryExpression = 164,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 163,
BinaryExpression = 165,
>BinaryExpression : SyntaxKind
ConditionalExpression = 164,
ConditionalExpression = 166,
>ConditionalExpression : SyntaxKind
TemplateExpression = 165,
TemplateExpression = 167,
>TemplateExpression : SyntaxKind
YieldExpression = 166,
YieldExpression = 168,
>YieldExpression : SyntaxKind
SpreadElementExpression = 167,
SpreadElementExpression = 169,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 168,
OmittedExpression = 170,
>OmittedExpression : SyntaxKind
TemplateSpan = 169,
TemplateSpan = 171,
>TemplateSpan : SyntaxKind
Block = 170,
Block = 172,
>Block : SyntaxKind
VariableStatement = 171,
VariableStatement = 173,
>VariableStatement : SyntaxKind
EmptyStatement = 172,
EmptyStatement = 174,
>EmptyStatement : SyntaxKind
ExpressionStatement = 173,
ExpressionStatement = 175,
>ExpressionStatement : SyntaxKind
IfStatement = 174,
IfStatement = 176,
>IfStatement : SyntaxKind
DoStatement = 175,
DoStatement = 177,
>DoStatement : SyntaxKind
WhileStatement = 176,
WhileStatement = 178,
>WhileStatement : SyntaxKind
ForStatement = 177,
ForStatement = 179,
>ForStatement : SyntaxKind
ForInStatement = 178,
ForInStatement = 180,
>ForInStatement : SyntaxKind
ContinueStatement = 179,
ForOfStatement = 181,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
>ContinueStatement : SyntaxKind
BreakStatement = 180,
BreakStatement = 183,
>BreakStatement : SyntaxKind
ReturnStatement = 181,
ReturnStatement = 184,
>ReturnStatement : SyntaxKind
WithStatement = 182,
WithStatement = 185,
>WithStatement : SyntaxKind
SwitchStatement = 183,
SwitchStatement = 186,
>SwitchStatement : SyntaxKind
LabeledStatement = 184,
LabeledStatement = 187,
>LabeledStatement : SyntaxKind
ThrowStatement = 185,
ThrowStatement = 188,
>ThrowStatement : SyntaxKind
TryStatement = 186,
TryStatement = 189,
>TryStatement : SyntaxKind
DebuggerStatement = 187,
DebuggerStatement = 190,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 188,
VariableDeclaration = 191,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 189,
VariableDeclarationList = 192,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 190,
FunctionDeclaration = 193,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 191,
ClassDeclaration = 194,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 192,
InterfaceDeclaration = 195,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 193,
TypeAliasDeclaration = 196,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 194,
EnumDeclaration = 197,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 195,
ModuleDeclaration = 198,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 196,
ModuleBlock = 199,
>ModuleBlock : SyntaxKind
ImportDeclaration = 197,
ImportDeclaration = 200,
>ImportDeclaration : SyntaxKind
ExportAssignment = 198,
ExportAssignment = 201,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 199,
ExternalModuleReference = 202,
>ExternalModuleReference : SyntaxKind
CaseClause = 200,
CaseClause = 203,
>CaseClause : SyntaxKind
DefaultClause = 201,
DefaultClause = 204,
>DefaultClause : SyntaxKind
HeritageClause = 202,
HeritageClause = 205,
>HeritageClause : SyntaxKind
CatchClause = 203,
CatchClause = 206,
>CatchClause : SyntaxKind
PropertyAssignment = 204,
PropertyAssignment = 207,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 205,
ShorthandPropertyAssignment = 208,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 206,
EnumMember = 209,
>EnumMember : SyntaxKind
SourceFile = 207,
SourceFile = 210,
>SourceFile : SyntaxKind
SyntaxList = 208,
SyntaxList = 211,
>SyntaxList : SyntaxKind
Count = 209,
Count = 212,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -936,7 +945,7 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 120,
LastKeyword = 122,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
@@ -945,10 +954,10 @@ declare module "typescript" {
LastFutureReservedWord = 109,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 135,
FirstTypeNode = 137,
>FirstTypeNode : SyntaxKind
LastTypeNode = 143,
LastTypeNode = 145,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -960,7 +969,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 120,
LastToken = 122,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -987,7 +996,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 121,
FirstNode = 123,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1968,6 +1977,19 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface ForOfStatement extends IterationStatement {
>ForOfStatement : ForOfStatement
>IterationStatement : IterationStatement
initializer: VariableDeclarationList | Expression;
>initializer : Expression | VariableDeclarationList
>VariableDeclarationList : VariableDeclarationList
>Expression : Expression
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface BreakOrContinueStatement extends Statement {
@@ -3416,10 +3438,13 @@ declare module "typescript" {
ContainsObjectLiteral = 524288,
>ContainsObjectLiteral : TypeFlags
Intrinsic = 127,
ESSymbol = 1048576,
>ESSymbol : TypeFlags
Intrinsic = 1048703,
>Intrinsic : TypeFlags
Primitive = 510,
Primitive = 1049086,
>Primitive : TypeFlags
StringLike = 258,
@@ -5059,9 +5084,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
@@ -5300,6 +5326,9 @@ declare module "typescript" {
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
[s: string]: boolean | number | string;
>s : string
}
interface DefinitionInfo {
>DefinitionInfo : DefinitionInfo
+107 -98
View File
@@ -248,110 +248,113 @@ declare module "typescript" {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -360,7 +363,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -691,6 +694,10 @@ declare module "typescript" {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -1100,8 +1107,9 @@ declare module "typescript" {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1602,7 +1610,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1677,6 +1685,7 @@ declare module "typescript" {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
+128 -99
View File
@@ -824,274 +824,283 @@ declare module "typescript" {
StringKeyword = 119,
>StringKeyword : SyntaxKind
TypeKeyword = 120,
SymbolKeyword = 120,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
>TypeKeyword : SyntaxKind
QualifiedName = 121,
OfKeyword = 122,
>OfKeyword : SyntaxKind
QualifiedName = 123,
>QualifiedName : SyntaxKind
ComputedPropertyName = 122,
ComputedPropertyName = 124,
>ComputedPropertyName : SyntaxKind
TypeParameter = 123,
TypeParameter = 125,
>TypeParameter : SyntaxKind
Parameter = 124,
Parameter = 126,
>Parameter : SyntaxKind
PropertySignature = 125,
PropertySignature = 127,
>PropertySignature : SyntaxKind
PropertyDeclaration = 126,
PropertyDeclaration = 128,
>PropertyDeclaration : SyntaxKind
MethodSignature = 127,
MethodSignature = 129,
>MethodSignature : SyntaxKind
MethodDeclaration = 128,
MethodDeclaration = 130,
>MethodDeclaration : SyntaxKind
Constructor = 129,
Constructor = 131,
>Constructor : SyntaxKind
GetAccessor = 130,
GetAccessor = 132,
>GetAccessor : SyntaxKind
SetAccessor = 131,
SetAccessor = 133,
>SetAccessor : SyntaxKind
CallSignature = 132,
CallSignature = 134,
>CallSignature : SyntaxKind
ConstructSignature = 133,
ConstructSignature = 135,
>ConstructSignature : SyntaxKind
IndexSignature = 134,
IndexSignature = 136,
>IndexSignature : SyntaxKind
TypeReference = 135,
TypeReference = 137,
>TypeReference : SyntaxKind
FunctionType = 136,
FunctionType = 138,
>FunctionType : SyntaxKind
ConstructorType = 137,
ConstructorType = 139,
>ConstructorType : SyntaxKind
TypeQuery = 138,
TypeQuery = 140,
>TypeQuery : SyntaxKind
TypeLiteral = 139,
TypeLiteral = 141,
>TypeLiteral : SyntaxKind
ArrayType = 140,
ArrayType = 142,
>ArrayType : SyntaxKind
TupleType = 141,
TupleType = 143,
>TupleType : SyntaxKind
UnionType = 142,
UnionType = 144,
>UnionType : SyntaxKind
ParenthesizedType = 143,
ParenthesizedType = 145,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 144,
ObjectBindingPattern = 146,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 145,
ArrayBindingPattern = 147,
>ArrayBindingPattern : SyntaxKind
BindingElement = 146,
BindingElement = 148,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 147,
ArrayLiteralExpression = 149,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 148,
ObjectLiteralExpression = 150,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 149,
PropertyAccessExpression = 151,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 150,
ElementAccessExpression = 152,
>ElementAccessExpression : SyntaxKind
CallExpression = 151,
CallExpression = 153,
>CallExpression : SyntaxKind
NewExpression = 152,
NewExpression = 154,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 153,
TaggedTemplateExpression = 155,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 154,
TypeAssertionExpression = 156,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 155,
ParenthesizedExpression = 157,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 156,
FunctionExpression = 158,
>FunctionExpression : SyntaxKind
ArrowFunction = 157,
ArrowFunction = 159,
>ArrowFunction : SyntaxKind
DeleteExpression = 158,
DeleteExpression = 160,
>DeleteExpression : SyntaxKind
TypeOfExpression = 159,
TypeOfExpression = 161,
>TypeOfExpression : SyntaxKind
VoidExpression = 160,
VoidExpression = 162,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 161,
PrefixUnaryExpression = 163,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 162,
PostfixUnaryExpression = 164,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 163,
BinaryExpression = 165,
>BinaryExpression : SyntaxKind
ConditionalExpression = 164,
ConditionalExpression = 166,
>ConditionalExpression : SyntaxKind
TemplateExpression = 165,
TemplateExpression = 167,
>TemplateExpression : SyntaxKind
YieldExpression = 166,
YieldExpression = 168,
>YieldExpression : SyntaxKind
SpreadElementExpression = 167,
SpreadElementExpression = 169,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 168,
OmittedExpression = 170,
>OmittedExpression : SyntaxKind
TemplateSpan = 169,
TemplateSpan = 171,
>TemplateSpan : SyntaxKind
Block = 170,
Block = 172,
>Block : SyntaxKind
VariableStatement = 171,
VariableStatement = 173,
>VariableStatement : SyntaxKind
EmptyStatement = 172,
EmptyStatement = 174,
>EmptyStatement : SyntaxKind
ExpressionStatement = 173,
ExpressionStatement = 175,
>ExpressionStatement : SyntaxKind
IfStatement = 174,
IfStatement = 176,
>IfStatement : SyntaxKind
DoStatement = 175,
DoStatement = 177,
>DoStatement : SyntaxKind
WhileStatement = 176,
WhileStatement = 178,
>WhileStatement : SyntaxKind
ForStatement = 177,
ForStatement = 179,
>ForStatement : SyntaxKind
ForInStatement = 178,
ForInStatement = 180,
>ForInStatement : SyntaxKind
ContinueStatement = 179,
ForOfStatement = 181,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
>ContinueStatement : SyntaxKind
BreakStatement = 180,
BreakStatement = 183,
>BreakStatement : SyntaxKind
ReturnStatement = 181,
ReturnStatement = 184,
>ReturnStatement : SyntaxKind
WithStatement = 182,
WithStatement = 185,
>WithStatement : SyntaxKind
SwitchStatement = 183,
SwitchStatement = 186,
>SwitchStatement : SyntaxKind
LabeledStatement = 184,
LabeledStatement = 187,
>LabeledStatement : SyntaxKind
ThrowStatement = 185,
ThrowStatement = 188,
>ThrowStatement : SyntaxKind
TryStatement = 186,
TryStatement = 189,
>TryStatement : SyntaxKind
DebuggerStatement = 187,
DebuggerStatement = 190,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 188,
VariableDeclaration = 191,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 189,
VariableDeclarationList = 192,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 190,
FunctionDeclaration = 193,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 191,
ClassDeclaration = 194,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 192,
InterfaceDeclaration = 195,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 193,
TypeAliasDeclaration = 196,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 194,
EnumDeclaration = 197,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 195,
ModuleDeclaration = 198,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 196,
ModuleBlock = 199,
>ModuleBlock : SyntaxKind
ImportDeclaration = 197,
ImportDeclaration = 200,
>ImportDeclaration : SyntaxKind
ExportAssignment = 198,
ExportAssignment = 201,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 199,
ExternalModuleReference = 202,
>ExternalModuleReference : SyntaxKind
CaseClause = 200,
CaseClause = 203,
>CaseClause : SyntaxKind
DefaultClause = 201,
DefaultClause = 204,
>DefaultClause : SyntaxKind
HeritageClause = 202,
HeritageClause = 205,
>HeritageClause : SyntaxKind
CatchClause = 203,
CatchClause = 206,
>CatchClause : SyntaxKind
PropertyAssignment = 204,
PropertyAssignment = 207,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 205,
ShorthandPropertyAssignment = 208,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 206,
EnumMember = 209,
>EnumMember : SyntaxKind
SourceFile = 207,
SourceFile = 210,
>SourceFile : SyntaxKind
SyntaxList = 208,
SyntaxList = 211,
>SyntaxList : SyntaxKind
Count = 209,
Count = 212,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -1109,7 +1118,7 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 120,
LastKeyword = 122,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
@@ -1118,10 +1127,10 @@ declare module "typescript" {
LastFutureReservedWord = 109,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 135,
FirstTypeNode = 137,
>FirstTypeNode : SyntaxKind
LastTypeNode = 143,
LastTypeNode = 145,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -1133,7 +1142,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 120,
LastToken = 122,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1160,7 +1169,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 121,
FirstNode = 123,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -2141,6 +2150,19 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface ForOfStatement extends IterationStatement {
>ForOfStatement : ForOfStatement
>IterationStatement : IterationStatement
initializer: VariableDeclarationList | Expression;
>initializer : Expression | VariableDeclarationList
>VariableDeclarationList : VariableDeclarationList
>Expression : Expression
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface BreakOrContinueStatement extends Statement {
@@ -3589,10 +3611,13 @@ declare module "typescript" {
ContainsObjectLiteral = 524288,
>ContainsObjectLiteral : TypeFlags
Intrinsic = 127,
ESSymbol = 1048576,
>ESSymbol : TypeFlags
Intrinsic = 1048703,
>Intrinsic : TypeFlags
Primitive = 510,
Primitive = 1049086,
>Primitive : TypeFlags
StringLike = 258,
@@ -5232,9 +5257,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
@@ -5473,6 +5499,9 @@ declare module "typescript" {
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
[s: string]: boolean | number | string;
>s : string
}
interface DefinitionInfo {
>DefinitionInfo : DefinitionInfo
@@ -0,0 +1,19 @@
tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (2 errors) ====
interface SymbolConstructor {
foo: string;
}
var Symbol: SymbolConstructor;
var obj = {
[Symbol.foo]: 0
~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'.
}
obj[Symbol.foo];
@@ -0,0 +1,18 @@
//// [ES5SymbolProperty1.ts]
interface SymbolConstructor {
foo: string;
}
var Symbol: SymbolConstructor;
var obj = {
[Symbol.foo]: 0
}
obj[Symbol.foo];
//// [ES5SymbolProperty1.js]
var Symbol;
var obj = {
[Symbol.foo]: 0
};
obj[Symbol.foo];
@@ -0,0 +1,22 @@
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (3 errors) ====
module M {
var Symbol;
export class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
(new C)[Symbol.iterator];
}
(new M.C)[Symbol.iterator];
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
@@ -0,0 +1,26 @@
//// [ES5SymbolProperty2.ts]
module M {
var Symbol;
export class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator];
}
(new M.C)[Symbol.iterator];
//// [ES5SymbolProperty2.js]
var M;
(function (M) {
var Symbol;
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
M.C = C;
(new C)[Symbol.iterator];
})(M || (M = {}));
(new M.C)[Symbol.iterator];
@@ -0,0 +1,16 @@
tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (2 errors) ====
var Symbol;
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
(new C)[Symbol.iterator]
@@ -0,0 +1,18 @@
//// [ES5SymbolProperty3.ts]
var Symbol;
class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator]
//// [ES5SymbolProperty3.js]
var Symbol;
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
(new C)[Symbol.iterator];
@@ -0,0 +1,16 @@
tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (2 errors) ====
var Symbol: { iterator: string };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
(new C)[Symbol.iterator]
@@ -0,0 +1,18 @@
//// [ES5SymbolProperty4.ts]
var Symbol: { iterator: string };
class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator]
//// [ES5SymbolProperty4.js]
var Symbol;
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
(new C)[Symbol.iterator];
@@ -0,0 +1,16 @@
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (2 errors) ====
var Symbol: { iterator: symbol };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
}
(new C)[Symbol.iterator](0) // Should error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
@@ -0,0 +1,18 @@
//// [ES5SymbolProperty5.ts]
var Symbol: { iterator: symbol };
class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator](0) // Should error
//// [ES5SymbolProperty5.js]
var Symbol;
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
(new C)[Symbol.iterator](0); // Should error
@@ -0,0 +1,17 @@
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'.
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (3 errors) ====
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
}
(new C)[Symbol.iterator]
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
@@ -0,0 +1,15 @@
//// [ES5SymbolProperty6.ts]
class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator]
//// [ES5SymbolProperty6.js]
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
(new C)[Symbol.iterator];
@@ -0,0 +1,16 @@
tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (2 errors) ====
var Symbol: { iterator: any };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
(new C)[Symbol.iterator]
@@ -0,0 +1,18 @@
//// [ES5SymbolProperty7.ts]
var Symbol: { iterator: any };
class C {
[Symbol.iterator]() { }
}
(new C)[Symbol.iterator]
//// [ES5SymbolProperty7.js]
var Symbol;
var C = (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
(new C)[Symbol.iterator];
@@ -0,0 +1,7 @@
//// [ES5SymbolType1.ts]
var s: symbol;
s.toString();
//// [ES5SymbolType1.js]
var s;
s.toString();
@@ -0,0 +1,10 @@
=== tests/cases/conformance/Symbols/ES5SymbolType1.ts ===
var s: symbol;
>s : symbol
s.toString();
>s.toString() : string
>s.toString : () => string
>s : symbol
>toString : () => string
@@ -1,5 +1,5 @@
tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'.
Named properties 'm' of types 'X' and 'Y' are not identical.
Named property 'm' of types 'X' and 'Y' are not identical.
==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ====
@@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac
interface Z extends X, Y { }
~
!!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'.
!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical.
!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I<number>' and 'I<string>'.
Named properties 'foo' of types 'I<number>' and 'I<string>' are not identical.
Named property 'foo' of types 'I<number>' and 'I<string>' are not identical.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
@@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha
interface A extends I<number>, I<string> { }
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'I<number>' and 'I<string>'.
!!! error TS2320: Named properties 'foo' of types 'I<number>' and 'I<string>' are not identical.
!!! error TS2320: Named property 'foo' of types 'I<number>' and 'I<string>' are not identical.
var x: A;
// BUG 822524
@@ -1,4 +1,4 @@
tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ====
@@ -55,5 +55,5 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): erro
// Only supported in when target is ES6
var c = new C(1, 2, ...a);
~~~~
!!! error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.
@@ -1,14 +1,14 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ====
@@ -18,35 +18,35 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12)
class C {
[s]: number;
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[n] = n;
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
static [s + s]: string;
~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[s + n] = 2;
~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[+s]: typeof s;
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
static [""]: number;
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[0]: number;
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[a]: number;
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
static [<any>true]: number;
~~~~~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
[`hello bye`] = 0;
~~~~~~~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
static [`hello ${a} bye`] = 0
~~~~~~~~~~~~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ====
@@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12):
class C {
[b]() {}
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static [true]() { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[[]]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static [{}]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[undefined]() { }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static [null]() { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ====
@@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5):
[p1]() { }
[p2]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[p3]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ====
@@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9):
class C {
get [b]() { return 0;}
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static set [true](v) { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
get [[]]() { return 0; }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
set [{}](v) { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static get [undefined]() { return 0; }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
set [null](v) { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ====
@@ -12,19 +12,19 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16):
[0 + 1]() { }
static [() => { }]() { }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
get [delete id]() { }
~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
set [[0, 1]](v) { }
~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static get [<String>""]() { }
~~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
static set [id.toString()](v) { }
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ====
@@ -9,5 +9,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10):
}
[foo<T>()]() { }
~
!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
!!! error TS2467: A computed property name cannot reference a type parameter from its containing type.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ====
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10):
bar(): string;
[foo<T>()](): void;
~~~~~~~~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
!!! error TS2467: A computed property name cannot reference a type parameter from its containing type.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5):
// Computed properties
[""]: Foo;
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
~~~~~~~~~~
!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ====
@@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): e
var v = {
[b]: 0,
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[true]: 1,
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[[]]: 0,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[{}]: 0,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[undefined]: undefined,
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[null]: null
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ====
@@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e
[p1]: 0,
[p2]: 1,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[p3]: 2
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ====
@@ -9,9 +9,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): e
var v = {
[t]: 0,
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
[u]: 1
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
};
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ====
@@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e
[f(0)]: 0,
[f(true)]: 0
~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ====
interface I {
["" + ""](): void;
~~~~~~~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ====
var v: {
["" + ""](): void;
~~~~~~~~~
!!! error TS1170: Computed property names are not allowed in type literals.
!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ====
@@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.
class C {
[methodName](v: string);
~~~~~~~~~~~~
!!! error TS1168: Computed property names are not allowed in method overloads.
!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol.
[methodName]();
~~~~~~~~~~~~
!!! error TS1168: Computed property names are not allowed in method overloads.
!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol.
[methodName](v?: string) { }
}
@@ -1,5 +1,5 @@
tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'.
Named properties 'm' of types 'B' and 'D' are not identical.
Named property 'm' of types 'B' and 'D' are not identical.
==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ====
@@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte
interface E extends B { } // Error here for extending B and D
~
!!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'.
!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical.
!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical.
interface E extends D { } // No duplicate error here
@@ -1,6 +1,6 @@
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ====
@@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
var x = 0;
~
!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
}
@@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
{
var y = 0;
~
!!! error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
!!! error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
}
}
@@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
const z = 0;
var z = 0
~
!!! error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
!!! error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
}
@@ -1,8 +1,8 @@
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2475: Property 'B' does not exist on 'const' enum 'E'.
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'.
==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ====
const enum E { A }
var x = E["B"]
~~~
!!! error TS2475: Property 'B' does not exist on 'const' enum 'E'.
!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'.
@@ -1,16 +1,16 @@
tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'.
tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'.
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2470: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(14,9): error TS2470: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(15,10): error TS2470: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(22,13): error TS2472: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(24,13): error TS2472: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(26,9): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(27,10): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(32,5): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(40,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(41,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
==== tests/cases/compiler/constEnumErrors.ts (13 errors) ====
@@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member
// forward reference to the element of the same enum
X = Y,
~
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
!!! error TS2474: In 'const' enum declarations member initializer must be constant expression.
// forward reference to the element of the same enum
Y = E1.Z,
~~~~
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
!!! error TS2474: In 'const' enum declarations member initializer must be constant expression.
Y1 = E1["Z"]
~~~~~~~
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
!!! error TS2474: In 'const' enum declarations member initializer must be constant expression.
}
const enum E2 {
@@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member
var y0 = E2[1]
~
!!! error TS2472: A const enum member can only be accessed using a string literal.
!!! error TS2476: A const enum member can only be accessed using a string literal.
var name = "A";
var y1 = E2[name];
~~~~
!!! error TS2472: A const enum member can only be accessed using a string literal.
!!! error TS2476: A const enum member can only be accessed using a string literal.
var x = E2;
~~
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
var y = [E2];
~~
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
function foo(t: any): void {
}
foo(E2);
~~
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
const enum NaNOrInfinity {
A = 9007199254740992,
@@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member
E = D * D,
F = E * E, // overflow
~~~~~
!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
G = 1 / 0, // overflow
~~~~~
!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
H = 0 / 0 // NaN
~~~~~
!!! error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
}
@@ -1,5 +1,5 @@
tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'f' of types 'Foo' and 'Bar' are not identical.
Named property 'f' of types 'Foo' and 'Bar' are not identical.
==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ====
@@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2
interface Hello extends Foo, Bar {
~~~~~
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical.
}
@@ -1,5 +1,5 @@
tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
Named properties 'f' of types 'Bar' and 'Foo' are not identical.
Named property 'f' of types 'Bar' and 'Foo' are not identical.
==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ====
@@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2
interface Hello extends Bar, Foo {
~~~~~
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical.
!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical.
}
+16 -16
View File
@@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter.
@@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter.
@@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter.
@@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter.
@@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter.
@@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter.
@@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed
tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter.
@@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be
tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
@@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
//Index Signature
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -1,10 +1,10 @@
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
@@ -15,7 +15,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
@@ -33,27 +33,27 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
var ra1 = a1 in x;
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra2 = a2 in x;
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra3 = a3 in x;
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra4 = a4 in x;
var ra5 = null in x;
~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra6 = undefined in x;
~~~~~~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra7 = E.a in x;
var ra8 = false in x;
~~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
var ra9 = {} in x;
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
// invalid right operands
// the right operand is required to be of type Any, an object type, or a type parameter type
@@ -98,6 +98,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
// both operands are invalid
var rc1 = {} in '';
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.
~~
!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
@@ -1,7 +1,7 @@
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'.
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation.
@@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021
// Used to be indexer, now it is a computed property
[x]: string;
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'x'.
[x: string];
@@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021
// Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'x'.
@@ -1,6 +1,6 @@
tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces.
tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'.
tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'.
@@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot
interface I {
[x = '']: string;
~~~~~~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'x'.
}
@@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot
class C {
[x = 0]: string
~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'x'.
}
@@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type '
tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'.
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ====
@@ -75,7 +75,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
yellow[blue]; // error
~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
var x:number[];
x[0];
@@ -1,4 +1,4 @@
tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'.
@@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n
// Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol.
~
!!! error TS2304: Cannot find name 'x'.
}
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.
==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ====
@@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.
==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ====
@@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11):
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.
==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ====
@@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11):
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
@@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in
Property 'prototype' is missing in type 'C1'.
tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type.
tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'.
Named properties 'foo' of types 'i10' and 'i11' are not identical.
Named property 'foo' of types 'i10' and 'i11' are not identical.
==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ====
@@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i
interface i12 extends i10, i11 { }
~~~
!!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'.
!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical.
!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical.
@@ -1,5 +1,5 @@
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'x' of types 'Foo' and 'Bar' are not identical.
Named property 'x' of types 'Foo' and 'Bar' are not identical.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
Property 'x' is private in type 'Bar' but not in type 'I4'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
@@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending
interface I3 extends Foo, Bar { // error
~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical.
}
interface I4 extends Foo, Bar { // error
@@ -1,5 +1,5 @@
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'x' of types 'Foo' and 'Bar' are not identical.
Named property 'x' of types 'Foo' and 'Bar' are not identical.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
Property 'x' is protected but type 'I4' is not a class derived from 'Bar'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
@@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending
interface I3 extends Foo, Bar { // error
~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical.
}
interface I4 extends Foo, Bar { // error
@@ -1,5 +1,5 @@
tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
Named properties 'name' of types 'i1' and 'i2' are not identical.
Named property 'name' of types 'i1' and 'i2' are not identical.
tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'.
Types of property 'name' are incompatible.
Type '() => string' is not assignable to type '() => { s: string; n: number; }'.
@@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1'
interface i3 extends i1, i2 { }
~~
!!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical.
!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical.
interface i4 extends i1, i2 { name(): { s: string; n: number; }; }
class C1 implements i4 {
@@ -1,7 +1,7 @@
tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'.
Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.
tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'.
Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.
==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ====
@@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I
interface MoverShaker extends Mover, Shaker {
~~~~~~~~~~~
!!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'.
!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.
}
@@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I
interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error
~~~~~~~~~~~~
!!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'.
!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.
interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker {
getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above
@@ -1,7 +1,7 @@
tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'.
Named properties 'a' of types 'E' and 'D' are not identical.
Named property 'a' of types 'E' and 'D' are not identical.
tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'.
Named properties 'a' of types 'E2' and 'D2' are not identical.
Named property 'a' of types 'E2' and 'D2' are not identical.
==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ====
@@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In
interface F extends E, D { } // error
~
!!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'.
!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical.
!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical.
class D2 { a: number; }
class E2 { a: string; }
interface F2 extends E2, D2 { } // error
~~
!!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'.
!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical.
!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical.
@@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
Types of property 'b' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3<T>' cannot simultaneously extend types 'Base1<number>' and 'Base2<number>'.
Named properties 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
Named property 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base1<number>'.
Types of property 'x' are incompatible.
Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'.
@@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
interface Derived3<T> extends Base1<number>, Base2<number> { } // error
~~~~~~~~
!!! error TS2320: Interface 'Derived3<T>' cannot simultaneously extend types 'Base1<number>' and 'Base2<number>'.
!!! error TS2320: Named properties 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
!!! error TS2320: Named property 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
interface Derived4<T> extends Base1<number>, Base2<number> { // error
~~~~~~~~
@@ -1,21 +1,21 @@
tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ====
{
let let = 1; // should error
~~~
!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
for (let let in []) { } // should error
~~~
!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
{
const let = 1; // should error
~~~
!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
}
{
function let() { // should be ok
@@ -1,7 +1,7 @@
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.
==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ====
@@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri
interface A extends C { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
@@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri
interface A extends C { // error, privates conflict
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
@@ -1,5 +1,5 @@
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A<T>' cannot simultaneously extend types 'C<string>' and 'C<number>'.
Named properties 'a' of types 'C<string>' and 'C<number>' are not identical.
Named property 'a' of types 'C<string>' and 'C<number>' are not identical.
==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ====
@@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultip
interface A<T> extends C<string>, C3<string> { // error
~
!!! error TS2320: Interface 'A<T>' cannot simultaneously extend types 'C<string>' and 'C<number>'.
!!! error TS2320: Named properties 'a' of types 'C<string>' and 'C<number>' are not identical.
!!! error TS2320: Named property 'a' of types 'C<string>' and 'C<number>' are not identical.
y: T;
}

Some files were not shown because too many files have changed in this diff Show More