Merge remote-tracking branch 'upstream/master' into jsxAndAs

This commit is contained in:
Ryan Cavanaugh
2015-06-22 22:41:41 -07:00
52 changed files with 17737 additions and 15413 deletions
+1 -1
View File
@@ -1165,7 +1165,7 @@ interface ArrayConstructor {
(arrayLength?: number): any[];
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): boolean;
isArray(arg: any): arg is Array<any>;
prototype: Array<any>;
}
+1 -1
View File
@@ -1165,7 +1165,7 @@ interface ArrayConstructor {
(arrayLength?: number): any[];
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): boolean;
isArray(arg: any): arg is Array<any>;
prototype: Array<any>;
}
+7 -2
View File
@@ -1165,7 +1165,7 @@ interface ArrayConstructor {
(arrayLength?: number): any[];
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): boolean;
isArray(arg: any): arg is Array<any>;
prototype: Array<any>;
}
@@ -3531,6 +3531,11 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
interface ResolvedNumberFormatOptions {
@@ -3593,7 +3598,7 @@ declare module Intl {
}
interface DateTimeFormat {
format(date: number): string;
format(date?: Date | number): string;
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
+6 -1
View File
@@ -2361,6 +2361,11 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
interface ResolvedNumberFormatOptions {
@@ -2423,7 +2428,7 @@ declare module Intl {
}
interface DateTimeFormat {
format(date: number): string;
format(date?: Date | number): string;
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
+17 -2
View File
@@ -1165,7 +1165,7 @@ interface ArrayConstructor {
(arrayLength?: number): any[];
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): boolean;
isArray(arg: any): arg is Array<any>;
prototype: Array<any>;
}
@@ -4909,6 +4909,11 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
interface ResolvedNumberFormatOptions {
@@ -4971,7 +4976,7 @@ declare module Intl {
}
interface DateTimeFormat {
format(date: number): string;
format(date?: Date | number): string;
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
@@ -18015,7 +18020,17 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) =>
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>;
}
interface NodeList {
[Symbol.iterator](): IterableIterator<Node>
}
interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>
}
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
+6 -1
View File
@@ -2361,6 +2361,11 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
interface ResolvedNumberFormatOptions {
@@ -2423,7 +2428,7 @@ declare module Intl {
}
interface DateTimeFormat {
format(date: number): string;
format(date?: Date | number): string;
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
+3256 -2875
View File
File diff suppressed because it is too large Load Diff
+4160 -3758
View File
File diff suppressed because it is too large Load Diff
+189 -160
View File
@@ -17,6 +17,13 @@ declare module "typescript" {
interface Map<T> {
[index: string]: T;
}
interface FileMap<T> {
get(fileName: string): T;
set(fileName: string, value: T): void;
contains(fileName: string): boolean;
remove(fileName: string): void;
forEachValue(f: (v: T) => void): void;
}
interface TextRange {
pos: number;
end: number;
@@ -139,156 +146,158 @@ declare module "typescript" {
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
NamespaceKeyword = 118,
RequireKeyword = 119,
NumberKeyword = 120,
SetKeyword = 121,
StringKeyword = 122,
SymbolKeyword = 123,
TypeKeyword = 124,
FromKeyword = 125,
OfKeyword = 126,
QualifiedName = 127,
ComputedPropertyName = 128,
TypeParameter = 129,
Parameter = 130,
Decorator = 131,
PropertySignature = 132,
PropertyDeclaration = 133,
MethodSignature = 134,
MethodDeclaration = 135,
Constructor = 136,
GetAccessor = 137,
SetAccessor = 138,
CallSignature = 139,
ConstructSignature = 140,
IndexSignature = 141,
TypeReference = 142,
FunctionType = 143,
ConstructorType = 144,
TypeQuery = 145,
TypeLiteral = 146,
ArrayType = 147,
TupleType = 148,
UnionType = 149,
ParenthesizedType = 150,
ObjectBindingPattern = 151,
ArrayBindingPattern = 152,
BindingElement = 153,
ArrayLiteralExpression = 154,
ObjectLiteralExpression = 155,
PropertyAccessExpression = 156,
ElementAccessExpression = 157,
CallExpression = 158,
NewExpression = 159,
TaggedTemplateExpression = 160,
TypeAssertionExpression = 161,
ParenthesizedExpression = 162,
FunctionExpression = 163,
ArrowFunction = 164,
DeleteExpression = 165,
TypeOfExpression = 166,
VoidExpression = 167,
PrefixUnaryExpression = 168,
PostfixUnaryExpression = 169,
BinaryExpression = 170,
ConditionalExpression = 171,
TemplateExpression = 172,
YieldExpression = 173,
SpreadElementExpression = 174,
ClassExpression = 175,
OmittedExpression = 176,
ExpressionWithTypeArguments = 177,
TemplateSpan = 178,
SemicolonClassElement = 179,
Block = 180,
VariableStatement = 181,
EmptyStatement = 182,
ExpressionStatement = 183,
IfStatement = 184,
DoStatement = 185,
WhileStatement = 186,
ForStatement = 187,
ForInStatement = 188,
ForOfStatement = 189,
ContinueStatement = 190,
BreakStatement = 191,
ReturnStatement = 192,
WithStatement = 193,
SwitchStatement = 194,
LabeledStatement = 195,
ThrowStatement = 196,
TryStatement = 197,
DebuggerStatement = 198,
VariableDeclaration = 199,
VariableDeclarationList = 200,
FunctionDeclaration = 201,
ClassDeclaration = 202,
InterfaceDeclaration = 203,
TypeAliasDeclaration = 204,
EnumDeclaration = 205,
ModuleDeclaration = 206,
ModuleBlock = 207,
CaseBlock = 208,
ImportEqualsDeclaration = 209,
ImportDeclaration = 210,
ImportClause = 211,
NamespaceImport = 212,
NamedImports = 213,
ImportSpecifier = 214,
ExportAssignment = 215,
ExportDeclaration = 216,
NamedExports = 217,
ExportSpecifier = 218,
MissingDeclaration = 219,
ExternalModuleReference = 220,
CaseClause = 221,
DefaultClause = 222,
HeritageClause = 223,
CatchClause = 224,
PropertyAssignment = 225,
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
JSDocTypeExpression = 229,
JSDocAllType = 230,
JSDocUnknownType = 231,
JSDocArrayType = 232,
JSDocUnionType = 233,
JSDocTupleType = 234,
JSDocNullableType = 235,
JSDocNonNullableType = 236,
JSDocRecordType = 237,
JSDocRecordMember = 238,
JSDocTypeReference = 239,
JSDocOptionalType = 240,
JSDocFunctionType = 241,
JSDocVariadicType = 242,
JSDocConstructorType = 243,
JSDocThisType = 244,
JSDocComment = 245,
JSDocTag = 246,
JSDocParameterTag = 247,
JSDocReturnTag = 248,
JSDocTypeTag = 249,
JSDocTemplateTag = 250,
SyntaxList = 251,
Count = 252,
IsKeyword = 117,
ModuleKeyword = 118,
NamespaceKeyword = 119,
RequireKeyword = 120,
NumberKeyword = 121,
SetKeyword = 122,
StringKeyword = 123,
SymbolKeyword = 124,
TypeKeyword = 125,
FromKeyword = 126,
OfKeyword = 127,
QualifiedName = 128,
ComputedPropertyName = 129,
TypeParameter = 130,
Parameter = 131,
Decorator = 132,
PropertySignature = 133,
PropertyDeclaration = 134,
MethodSignature = 135,
MethodDeclaration = 136,
Constructor = 137,
GetAccessor = 138,
SetAccessor = 139,
CallSignature = 140,
ConstructSignature = 141,
IndexSignature = 142,
TypePredicate = 143,
TypeReference = 144,
FunctionType = 145,
ConstructorType = 146,
TypeQuery = 147,
TypeLiteral = 148,
ArrayType = 149,
TupleType = 150,
UnionType = 151,
ParenthesizedType = 152,
ObjectBindingPattern = 153,
ArrayBindingPattern = 154,
BindingElement = 155,
ArrayLiteralExpression = 156,
ObjectLiteralExpression = 157,
PropertyAccessExpression = 158,
ElementAccessExpression = 159,
CallExpression = 160,
NewExpression = 161,
TaggedTemplateExpression = 162,
TypeAssertionExpression = 163,
ParenthesizedExpression = 164,
FunctionExpression = 165,
ArrowFunction = 166,
DeleteExpression = 167,
TypeOfExpression = 168,
VoidExpression = 169,
PrefixUnaryExpression = 170,
PostfixUnaryExpression = 171,
BinaryExpression = 172,
ConditionalExpression = 173,
TemplateExpression = 174,
YieldExpression = 175,
SpreadElementExpression = 176,
ClassExpression = 177,
OmittedExpression = 178,
ExpressionWithTypeArguments = 179,
TemplateSpan = 180,
SemicolonClassElement = 181,
Block = 182,
VariableStatement = 183,
EmptyStatement = 184,
ExpressionStatement = 185,
IfStatement = 186,
DoStatement = 187,
WhileStatement = 188,
ForStatement = 189,
ForInStatement = 190,
ForOfStatement = 191,
ContinueStatement = 192,
BreakStatement = 193,
ReturnStatement = 194,
WithStatement = 195,
SwitchStatement = 196,
LabeledStatement = 197,
ThrowStatement = 198,
TryStatement = 199,
DebuggerStatement = 200,
VariableDeclaration = 201,
VariableDeclarationList = 202,
FunctionDeclaration = 203,
ClassDeclaration = 204,
InterfaceDeclaration = 205,
TypeAliasDeclaration = 206,
EnumDeclaration = 207,
ModuleDeclaration = 208,
ModuleBlock = 209,
CaseBlock = 210,
ImportEqualsDeclaration = 211,
ImportDeclaration = 212,
ImportClause = 213,
NamespaceImport = 214,
NamedImports = 215,
ImportSpecifier = 216,
ExportAssignment = 217,
ExportDeclaration = 218,
NamedExports = 219,
ExportSpecifier = 220,
MissingDeclaration = 221,
ExternalModuleReference = 222,
CaseClause = 223,
DefaultClause = 224,
HeritageClause = 225,
CatchClause = 226,
PropertyAssignment = 227,
ShorthandPropertyAssignment = 228,
EnumMember = 229,
SourceFile = 230,
JSDocTypeExpression = 231,
JSDocAllType = 232,
JSDocUnknownType = 233,
JSDocArrayType = 234,
JSDocUnionType = 235,
JSDocTupleType = 236,
JSDocNullableType = 237,
JSDocNonNullableType = 238,
JSDocRecordType = 239,
JSDocRecordMember = 240,
JSDocTypeReference = 241,
JSDocOptionalType = 242,
JSDocFunctionType = 243,
JSDocVariadicType = 244,
JSDocConstructorType = 245,
JSDocThisType = 246,
JSDocComment = 247,
JSDocTag = 248,
JSDocParameterTag = 249,
JSDocReturnTag = 250,
JSDocTypeTag = 251,
JSDocTemplateTag = 252,
SyntaxList = 253,
Count = 254,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 126,
LastKeyword = 127,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 142,
LastTypeNode = 150,
FirstTypeNode = 144,
LastTypeNode = 152,
FirstPunctuation = 14,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 126,
LastToken = 127,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -297,7 +306,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 64,
FirstNode = 127,
FirstNode = 128,
}
const enum NodeFlags {
Export = 1,
@@ -458,6 +467,10 @@ declare module "typescript" {
typeName: EntityName;
typeArguments?: NodeArray<TypeNode>;
}
interface TypePredicateNode extends TypeNode {
parameterName: Identifier;
type: TypeNode;
}
interface TypeQueryNode extends TypeNode {
exprName: EntityName;
}
@@ -592,7 +605,7 @@ declare module "typescript" {
type: TypeNode;
expression: UnaryExpression;
}
interface Statement extends Node, ModuleElement {
interface Statement extends Node {
_statementBrand: any;
}
interface Block extends Statement {
@@ -672,9 +685,6 @@ declare module "typescript" {
variableDeclaration: VariableDeclaration;
block: Block;
}
interface ModuleElement extends Node {
_moduleElementBrand: any;
}
interface ClassLikeDeclaration extends Declaration {
name?: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
@@ -700,6 +710,7 @@ declare module "typescript" {
}
interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
type: TypeNode;
}
interface EnumMember extends Declaration {
@@ -710,21 +721,21 @@ declare module "typescript" {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ModuleDeclaration extends Declaration, Statement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
}
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, Statement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends ModuleElement {
interface ImportDeclaration extends Statement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
@@ -735,7 +746,7 @@ declare module "typescript" {
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Declaration, ModuleElement {
interface ExportDeclaration extends Declaration, Statement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
@@ -750,7 +761,7 @@ declare module "typescript" {
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
interface ExportAssignment extends Declaration, Statement {
isExportEquals?: boolean;
expression: Expression;
}
@@ -838,7 +849,7 @@ declare module "typescript" {
isBracketed: boolean;
}
interface SourceFile extends Declaration {
statements: NodeArray<ModuleElement>;
statements: NodeArray<Statement>;
endOfFileToken: Node;
fileName: string;
text: string;
@@ -846,8 +857,16 @@ declare module "typescript" {
path: string;
name: string;
}[];
amdModuleName: string;
moduleName: string;
referencedFiles: FileReference[];
/**
* lib.d.ts should have a reference comment like
*
* /// <reference no-default-lib="true"/>
*
* If any other file has this comment, it signals not to include lib.d.ts
* because this containing file is intended to act as a default library.
*/
hasNoDefaultLib: boolean;
languageVersion: ScriptTarget;
}
@@ -878,8 +897,9 @@ declare module "typescript" {
* will be invoked when writing the JavaScript and declaration files.
*/
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getOptionsDiagnostics(): Diagnostic[];
getGlobalDiagnostics(): Diagnostic[];
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
/**
@@ -998,6 +1018,11 @@ declare module "typescript" {
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
}
interface TypePredicate {
parameterName: string;
parameterIndex: number;
type: Type;
}
const enum SymbolFlags {
None = 0,
FunctionScopedVariable = 1,
@@ -1060,6 +1085,7 @@ declare module "typescript" {
ExportHasLocal = 944,
HasExports = 1952,
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
Export = 7340032,
}
@@ -1111,9 +1137,8 @@ declare module "typescript" {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
}
interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
resolvedBaseConstructorType?: Type;
resolvedBaseTypes: ObjectType[];
}
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
declaredProperties: Symbol[];
@@ -1146,6 +1171,7 @@ declare module "typescript" {
declaration: SignatureDeclaration;
typeParameters: TypeParameter[];
parameters: Symbol[];
typePredicate?: TypePredicate;
}
const enum IndexKind {
String = 0,
@@ -1323,6 +1349,7 @@ declare module "typescript" {
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
function isWhiteSpace(ch: number): boolean;
function isLineBreak(ch: number): boolean;
function couldStartTrivia(text: string, pos: number): boolean;
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
@@ -1338,6 +1365,7 @@ declare module "typescript" {
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
function createTextSpan(start: number, length: number): TextSpan;
@@ -1490,6 +1518,7 @@ declare module "typescript" {
log?(s: string): void;
trace?(s: string): void;
error?(s: string): void;
useCaseSensitiveFileNames?(): boolean;
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -1948,11 +1977,11 @@ declare module "typescript" {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
function createClassifier(): Classifier;
+4672 -4202
View File
File diff suppressed because it is too large Load Diff
+197 -168
View File
@@ -13,10 +13,17 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
declare module ts {
declare namespace ts {
interface Map<T> {
[index: string]: T;
}
interface FileMap<T> {
get(fileName: string): T;
set(fileName: string, value: T): void;
contains(fileName: string): boolean;
remove(fileName: string): void;
forEachValue(f: (v: T) => void): void;
}
interface TextRange {
pos: number;
end: number;
@@ -139,156 +146,158 @@ declare module ts {
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
NamespaceKeyword = 118,
RequireKeyword = 119,
NumberKeyword = 120,
SetKeyword = 121,
StringKeyword = 122,
SymbolKeyword = 123,
TypeKeyword = 124,
FromKeyword = 125,
OfKeyword = 126,
QualifiedName = 127,
ComputedPropertyName = 128,
TypeParameter = 129,
Parameter = 130,
Decorator = 131,
PropertySignature = 132,
PropertyDeclaration = 133,
MethodSignature = 134,
MethodDeclaration = 135,
Constructor = 136,
GetAccessor = 137,
SetAccessor = 138,
CallSignature = 139,
ConstructSignature = 140,
IndexSignature = 141,
TypeReference = 142,
FunctionType = 143,
ConstructorType = 144,
TypeQuery = 145,
TypeLiteral = 146,
ArrayType = 147,
TupleType = 148,
UnionType = 149,
ParenthesizedType = 150,
ObjectBindingPattern = 151,
ArrayBindingPattern = 152,
BindingElement = 153,
ArrayLiteralExpression = 154,
ObjectLiteralExpression = 155,
PropertyAccessExpression = 156,
ElementAccessExpression = 157,
CallExpression = 158,
NewExpression = 159,
TaggedTemplateExpression = 160,
TypeAssertionExpression = 161,
ParenthesizedExpression = 162,
FunctionExpression = 163,
ArrowFunction = 164,
DeleteExpression = 165,
TypeOfExpression = 166,
VoidExpression = 167,
PrefixUnaryExpression = 168,
PostfixUnaryExpression = 169,
BinaryExpression = 170,
ConditionalExpression = 171,
TemplateExpression = 172,
YieldExpression = 173,
SpreadElementExpression = 174,
ClassExpression = 175,
OmittedExpression = 176,
ExpressionWithTypeArguments = 177,
TemplateSpan = 178,
SemicolonClassElement = 179,
Block = 180,
VariableStatement = 181,
EmptyStatement = 182,
ExpressionStatement = 183,
IfStatement = 184,
DoStatement = 185,
WhileStatement = 186,
ForStatement = 187,
ForInStatement = 188,
ForOfStatement = 189,
ContinueStatement = 190,
BreakStatement = 191,
ReturnStatement = 192,
WithStatement = 193,
SwitchStatement = 194,
LabeledStatement = 195,
ThrowStatement = 196,
TryStatement = 197,
DebuggerStatement = 198,
VariableDeclaration = 199,
VariableDeclarationList = 200,
FunctionDeclaration = 201,
ClassDeclaration = 202,
InterfaceDeclaration = 203,
TypeAliasDeclaration = 204,
EnumDeclaration = 205,
ModuleDeclaration = 206,
ModuleBlock = 207,
CaseBlock = 208,
ImportEqualsDeclaration = 209,
ImportDeclaration = 210,
ImportClause = 211,
NamespaceImport = 212,
NamedImports = 213,
ImportSpecifier = 214,
ExportAssignment = 215,
ExportDeclaration = 216,
NamedExports = 217,
ExportSpecifier = 218,
MissingDeclaration = 219,
ExternalModuleReference = 220,
CaseClause = 221,
DefaultClause = 222,
HeritageClause = 223,
CatchClause = 224,
PropertyAssignment = 225,
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
JSDocTypeExpression = 229,
JSDocAllType = 230,
JSDocUnknownType = 231,
JSDocArrayType = 232,
JSDocUnionType = 233,
JSDocTupleType = 234,
JSDocNullableType = 235,
JSDocNonNullableType = 236,
JSDocRecordType = 237,
JSDocRecordMember = 238,
JSDocTypeReference = 239,
JSDocOptionalType = 240,
JSDocFunctionType = 241,
JSDocVariadicType = 242,
JSDocConstructorType = 243,
JSDocThisType = 244,
JSDocComment = 245,
JSDocTag = 246,
JSDocParameterTag = 247,
JSDocReturnTag = 248,
JSDocTypeTag = 249,
JSDocTemplateTag = 250,
SyntaxList = 251,
Count = 252,
IsKeyword = 117,
ModuleKeyword = 118,
NamespaceKeyword = 119,
RequireKeyword = 120,
NumberKeyword = 121,
SetKeyword = 122,
StringKeyword = 123,
SymbolKeyword = 124,
TypeKeyword = 125,
FromKeyword = 126,
OfKeyword = 127,
QualifiedName = 128,
ComputedPropertyName = 129,
TypeParameter = 130,
Parameter = 131,
Decorator = 132,
PropertySignature = 133,
PropertyDeclaration = 134,
MethodSignature = 135,
MethodDeclaration = 136,
Constructor = 137,
GetAccessor = 138,
SetAccessor = 139,
CallSignature = 140,
ConstructSignature = 141,
IndexSignature = 142,
TypePredicate = 143,
TypeReference = 144,
FunctionType = 145,
ConstructorType = 146,
TypeQuery = 147,
TypeLiteral = 148,
ArrayType = 149,
TupleType = 150,
UnionType = 151,
ParenthesizedType = 152,
ObjectBindingPattern = 153,
ArrayBindingPattern = 154,
BindingElement = 155,
ArrayLiteralExpression = 156,
ObjectLiteralExpression = 157,
PropertyAccessExpression = 158,
ElementAccessExpression = 159,
CallExpression = 160,
NewExpression = 161,
TaggedTemplateExpression = 162,
TypeAssertionExpression = 163,
ParenthesizedExpression = 164,
FunctionExpression = 165,
ArrowFunction = 166,
DeleteExpression = 167,
TypeOfExpression = 168,
VoidExpression = 169,
PrefixUnaryExpression = 170,
PostfixUnaryExpression = 171,
BinaryExpression = 172,
ConditionalExpression = 173,
TemplateExpression = 174,
YieldExpression = 175,
SpreadElementExpression = 176,
ClassExpression = 177,
OmittedExpression = 178,
ExpressionWithTypeArguments = 179,
TemplateSpan = 180,
SemicolonClassElement = 181,
Block = 182,
VariableStatement = 183,
EmptyStatement = 184,
ExpressionStatement = 185,
IfStatement = 186,
DoStatement = 187,
WhileStatement = 188,
ForStatement = 189,
ForInStatement = 190,
ForOfStatement = 191,
ContinueStatement = 192,
BreakStatement = 193,
ReturnStatement = 194,
WithStatement = 195,
SwitchStatement = 196,
LabeledStatement = 197,
ThrowStatement = 198,
TryStatement = 199,
DebuggerStatement = 200,
VariableDeclaration = 201,
VariableDeclarationList = 202,
FunctionDeclaration = 203,
ClassDeclaration = 204,
InterfaceDeclaration = 205,
TypeAliasDeclaration = 206,
EnumDeclaration = 207,
ModuleDeclaration = 208,
ModuleBlock = 209,
CaseBlock = 210,
ImportEqualsDeclaration = 211,
ImportDeclaration = 212,
ImportClause = 213,
NamespaceImport = 214,
NamedImports = 215,
ImportSpecifier = 216,
ExportAssignment = 217,
ExportDeclaration = 218,
NamedExports = 219,
ExportSpecifier = 220,
MissingDeclaration = 221,
ExternalModuleReference = 222,
CaseClause = 223,
DefaultClause = 224,
HeritageClause = 225,
CatchClause = 226,
PropertyAssignment = 227,
ShorthandPropertyAssignment = 228,
EnumMember = 229,
SourceFile = 230,
JSDocTypeExpression = 231,
JSDocAllType = 232,
JSDocUnknownType = 233,
JSDocArrayType = 234,
JSDocUnionType = 235,
JSDocTupleType = 236,
JSDocNullableType = 237,
JSDocNonNullableType = 238,
JSDocRecordType = 239,
JSDocRecordMember = 240,
JSDocTypeReference = 241,
JSDocOptionalType = 242,
JSDocFunctionType = 243,
JSDocVariadicType = 244,
JSDocConstructorType = 245,
JSDocThisType = 246,
JSDocComment = 247,
JSDocTag = 248,
JSDocParameterTag = 249,
JSDocReturnTag = 250,
JSDocTypeTag = 251,
JSDocTemplateTag = 252,
SyntaxList = 253,
Count = 254,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 126,
LastKeyword = 127,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 142,
LastTypeNode = 150,
FirstTypeNode = 144,
LastTypeNode = 152,
FirstPunctuation = 14,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 126,
LastToken = 127,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -297,7 +306,7 @@ declare module ts {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 64,
FirstNode = 127,
FirstNode = 128,
}
const enum NodeFlags {
Export = 1,
@@ -458,6 +467,10 @@ declare module ts {
typeName: EntityName;
typeArguments?: NodeArray<TypeNode>;
}
interface TypePredicateNode extends TypeNode {
parameterName: Identifier;
type: TypeNode;
}
interface TypeQueryNode extends TypeNode {
exprName: EntityName;
}
@@ -592,7 +605,7 @@ declare module ts {
type: TypeNode;
expression: UnaryExpression;
}
interface Statement extends Node, ModuleElement {
interface Statement extends Node {
_statementBrand: any;
}
interface Block extends Statement {
@@ -672,9 +685,6 @@ declare module ts {
variableDeclaration: VariableDeclaration;
block: Block;
}
interface ModuleElement extends Node {
_moduleElementBrand: any;
}
interface ClassLikeDeclaration extends Declaration {
name?: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
@@ -700,6 +710,7 @@ declare module ts {
}
interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
type: TypeNode;
}
interface EnumMember extends Declaration {
@@ -710,21 +721,21 @@ declare module ts {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ModuleDeclaration extends Declaration, Statement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
}
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, Statement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends ModuleElement {
interface ImportDeclaration extends Statement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
@@ -735,7 +746,7 @@ declare module ts {
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Declaration, ModuleElement {
interface ExportDeclaration extends Declaration, Statement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
@@ -750,7 +761,7 @@ declare module ts {
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Declaration, ModuleElement {
interface ExportAssignment extends Declaration, Statement {
isExportEquals?: boolean;
expression: Expression;
}
@@ -838,7 +849,7 @@ declare module ts {
isBracketed: boolean;
}
interface SourceFile extends Declaration {
statements: NodeArray<ModuleElement>;
statements: NodeArray<Statement>;
endOfFileToken: Node;
fileName: string;
text: string;
@@ -846,8 +857,16 @@ declare module ts {
path: string;
name: string;
}[];
amdModuleName: string;
moduleName: string;
referencedFiles: FileReference[];
/**
* lib.d.ts should have a reference comment like
*
* /// <reference no-default-lib="true"/>
*
* If any other file has this comment, it signals not to include lib.d.ts
* because this containing file is intended to act as a default library.
*/
hasNoDefaultLib: boolean;
languageVersion: ScriptTarget;
}
@@ -878,8 +897,9 @@ declare module ts {
* will be invoked when writing the JavaScript and declaration files.
*/
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getOptionsDiagnostics(): Diagnostic[];
getGlobalDiagnostics(): Diagnostic[];
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
/**
@@ -998,6 +1018,11 @@ declare module ts {
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
}
interface TypePredicate {
parameterName: string;
parameterIndex: number;
type: Type;
}
const enum SymbolFlags {
None = 0,
FunctionScopedVariable = 1,
@@ -1060,6 +1085,7 @@ declare module ts {
ExportHasLocal = 944,
HasExports = 1952,
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
Export = 7340032,
}
@@ -1111,9 +1137,8 @@ declare module ts {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
}
interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
resolvedBaseConstructorType?: Type;
resolvedBaseTypes: ObjectType[];
}
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
declaredProperties: Symbol[];
@@ -1146,6 +1171,7 @@ declare module ts {
declaration: SignatureDeclaration;
typeParameters: TypeParameter[];
parameters: Symbol[];
typePredicate?: TypePredicate;
}
const enum IndexKind {
String = 0,
@@ -1267,7 +1293,7 @@ declare module ts {
newLength: number;
}
}
declare module ts {
declare namespace ts {
interface System {
args: string[];
newLine: string;
@@ -1291,7 +1317,7 @@ declare module ts {
}
var sys: System;
}
declare module ts {
declare namespace ts {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
@@ -1323,12 +1349,13 @@ declare module ts {
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
function isWhiteSpace(ch: number): boolean;
function isLineBreak(ch: number): boolean;
function couldStartTrivia(text: string, pos: number): boolean;
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
}
declare module ts {
declare namespace ts {
function getDefaultLibFileName(options: CompilerOptions): string;
function textSpanEnd(span: TextSpan): number;
function textSpanIsEmpty(span: TextSpan): boolean;
@@ -1338,6 +1365,7 @@ declare module ts {
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
function createTextSpan(start: number, length: number): TextSpan;
@@ -1357,14 +1385,14 @@ declare module ts {
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
}
declare module ts {
declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node;
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
declare module ts {
declare namespace ts {
/** The version of the TypeScript compiler release */
const version: string;
function findConfigFile(searchPath: string): string;
@@ -1373,7 +1401,7 @@ declare module ts {
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
}
declare module ts {
declare namespace ts {
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
/**
* Read tsconfig.json file
@@ -1400,7 +1428,7 @@ declare module ts {
*/
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare module ts {
declare namespace ts {
/** The version of the language service API */
let servicesVersion: string;
interface Node {
@@ -1490,6 +1518,7 @@ declare module ts {
log?(s: string): void;
trace?(s: string): void;
error?(s: string): void;
useCaseSensitiveFileNames?(): boolean;
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -1948,11 +1977,11 @@ declare module ts {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
function createClassifier(): Classifier;
+4672 -4202
View File
File diff suppressed because it is too large Load Diff
+26 -8
View File
@@ -379,21 +379,38 @@ namespace ts {
case SyntaxKind.SourceFile:
if (!isExternalModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.ModuleMember)) {
if (result.flags & meaning || !(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
break loop;
}
result = undefined;
}
else if (location.kind === SyntaxKind.SourceFile ||
let moduleExports = getSymbolOfNode(location).exports;
if (location.kind === SyntaxKind.SourceFile ||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
result = getSymbolOfNode(location).exports["default"];
// It's an external module. Because of module/namespace merging, a module's exports are in scope,
// yet we never want to treat an export specifier as putting a member in scope. Therefore,
// if the name we find is purely an export specifier, it is not actually considered in scope.
// Two things to note about this:
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
// on an export specifier is that it might find the export specifier itself, and try to
// resolve it as an alias. This will cause the checker to consider the export specifier
// a circular alias reference when it might not be.
// 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely*
// an alias. If we used &, we'd be throwing out symbols that have non alias aspects,
// which is not the desired behavior.
if (hasProperty(moduleExports, name) &&
moduleExports[name].flags === SymbolFlags.Alias &&
getDeclarationOfKind(moduleExports[name], SyntaxKind.ExportSpecifier)) {
break;
}
result = moduleExports["default"];
let localSymbol = getLocalSymbolForExportDefault(result);
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
break loop;
}
result = undefined;
}
if (result = getSymbol(moduleExports, name, meaning & SymbolFlags.ModuleMember)) {
break loop;
}
break;
case SyntaxKind.EnumDeclaration:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.EnumMember)) {
@@ -5795,6 +5812,7 @@ namespace ts {
let signature = getResolvedSignature(expr);
if (signature.typePredicate &&
expr.arguments[signature.typePredicate.parameterIndex] &&
getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) {
if (!assumeTrue) {
+1
View File
@@ -120,6 +120,7 @@ namespace ts {
{
name: "out",
type: "string",
isFilePath: true,
description: Diagnostics.Concatenate_and_emit_output_to_single_file,
paramType: Diagnostics.FILE,
},
+1 -1
View File
@@ -5571,7 +5571,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
decreaseIndent();
writeLine();
write("}"); // return
emitTempDeclarations(/*newLine*/ true)
emitTempDeclarations(/*newLine*/ true);
}
function emitSetters(exportStarFunction: string) {
+11 -3
View File
@@ -1534,12 +1534,20 @@ namespace ts {
switch (node.kind) {
case SyntaxKind.Constructor:
case SyntaxKind.IndexSignature:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.SemicolonClassElement:
return true;
case SyntaxKind.MethodDeclaration:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
let methodDeclaration = <MethodDeclaration>node;
let nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier &&
(<Identifier>methodDeclaration.name).originalKeywordKind === SyntaxKind.ConstructorKeyword;
return !nameIsConstructor;
}
}
@@ -4241,7 +4249,7 @@ namespace ts {
parseExportAssignment(fullStart, decorators, modifiers) :
parseExportDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
if (decorators || modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <Statement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
@@ -4643,7 +4651,7 @@ namespace ts {
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators) {
if (decorators || modifiers) {
// treat this as a property declaration with a missing name.
let name = <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined);
@@ -0,0 +1,12 @@
tests/cases/compiler/classMemberWithMissingIdentifier.ts(2,11): error TS1146: Declaration expected.
tests/cases/compiler/classMemberWithMissingIdentifier.ts(2,12): error TS1005: '=' expected.
==== tests/cases/compiler/classMemberWithMissingIdentifier.ts (2 errors) ====
class C {
public {};
!!! error TS1146: Declaration expected.
~
!!! error TS1005: '=' expected.
}
@@ -0,0 +1,12 @@
//// [classMemberWithMissingIdentifier.ts]
class C {
public {};
}
//// [classMemberWithMissingIdentifier.js]
var C = (function () {
function C() {
this. = {};
}
return C;
})();
@@ -0,0 +1,30 @@
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,11): error TS1146: Declaration expected.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,12): error TS1005: '=' expected.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,14): error TS2304: Cannot find name 'name'.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,18): error TS1005: ']' expected.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,19): error TS2304: Cannot find name 'string'.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,25): error TS1005: ',' expected.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,26): error TS1136: Property assignment expected.
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,27): error TS2304: Cannot find name 'VariableDeclaration'.
==== tests/cases/compiler/classMemberWithMissingIdentifier2.ts (8 errors) ====
class C {
public {[name:string]:VariableDeclaration};
!!! error TS1146: Declaration expected.
~
!!! error TS1005: '=' expected.
~~~~
!!! error TS2304: Cannot find name 'name'.
~
!!! error TS1005: ']' expected.
~~~~~~
!!! error TS2304: Cannot find name 'string'.
~
!!! error TS1005: ',' expected.
~
!!! error TS1136: Property assignment expected.
~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'VariableDeclaration'.
}
@@ -0,0 +1,13 @@
//// [classMemberWithMissingIdentifier2.ts]
class C {
public {[name:string]:VariableDeclaration};
}
//// [classMemberWithMissingIdentifier2.js]
var C = (function () {
function C() {
this. = (_a = {}, _a[name] = string, _a.VariableDeclaration = VariableDeclaration, _a);
var _a;
}
return C;
})();
@@ -0,0 +1,15 @@
//// [exportSpecifierAndExportedMemberDeclaration.ts]
declare module "m2" {
export module X {
interface I { }
}
function Y();
export { Y as X };
function Z(): X.I;
}
declare module "m2" {
function Z2(): X.I;
}
//// [exportSpecifierAndExportedMemberDeclaration.js]
@@ -0,0 +1,27 @@
=== tests/cases/compiler/exportSpecifierAndExportedMemberDeclaration.ts ===
declare module "m2" {
export module X {
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
interface I { }
>I : Symbol(I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
}
function Y();
>Y : Symbol(Y, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 3, 5))
export { Y as X };
>Y : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
function Z(): X.I;
>Z : Symbol(Z, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 22))
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
>I : Symbol(X.I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
}
declare module "m2" {
function Z2(): X.I;
>Z2 : Symbol(Z2, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 9, 21))
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
>I : Symbol(X.I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
}
@@ -0,0 +1,27 @@
=== tests/cases/compiler/exportSpecifierAndExportedMemberDeclaration.ts ===
declare module "m2" {
export module X {
>X : () => any
interface I { }
>I : I
}
function Y();
>Y : () => any
export { Y as X };
>Y : () => any
>X : () => any
function Z(): X.I;
>Z : () => X.I
>X : any
>I : X.I
}
declare module "m2" {
function Z2(): X.I;
>Z2 : () => X.I
>X : any
>I : X.I
}
@@ -0,0 +1,18 @@
tests/cases/compiler/exportSpecifierAndLocalMemberDeclaration.ts(11,20): error TS2503: Cannot find namespace 'X'.
==== tests/cases/compiler/exportSpecifierAndLocalMemberDeclaration.ts (1 errors) ====
declare module "m2" {
module X {
interface I { }
}
function Y();
export { Y as X };
function Z(): X.I;
}
declare module "m2" {
function Z2(): X.I;
~
!!! error TS2503: Cannot find namespace 'X'.
}
@@ -0,0 +1,15 @@
//// [exportSpecifierAndLocalMemberDeclaration.ts]
declare module "m2" {
module X {
interface I { }
}
function Y();
export { Y as X };
function Z(): X.I;
}
declare module "m2" {
function Z2(): X.I;
}
//// [exportSpecifierAndLocalMemberDeclaration.js]
@@ -0,0 +1,8 @@
//// [exportSpecifierReferencingOuterDeclaration1.ts]
declare module X { export interface bar { } }
declare module "m" {
export { X };
export function foo(): X.bar;
}
//// [exportSpecifierReferencingOuterDeclaration1.js]
@@ -0,0 +1,14 @@
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts ===
declare module X { export interface bar { } }
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0))
>bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18))
declare module "m" {
export { X };
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 12))
export function foo(): X.bar;
>foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 17))
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0))
>bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18))
}
@@ -0,0 +1,14 @@
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts ===
declare module X { export interface bar { } }
>X : any
>bar : bar
declare module "m" {
export { X };
>X : any
export function foo(): X.bar;
>foo : () => X.bar
>X : any
>bar : X.bar
}
@@ -0,0 +1,11 @@
//// [tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2.ts] ////
//// [exportSpecifierReferencingOuterDeclaration2_A.ts]
declare module X { export interface bar { } }
//// [exportSpecifierReferencingOuterDeclaration2_B.ts]
export { X };
export declare function foo(): X.bar;
//// [exportSpecifierReferencingOuterDeclaration2_A.js]
//// [exportSpecifierReferencingOuterDeclaration2_B.js]
@@ -0,0 +1,14 @@
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts ===
declare module X { export interface bar { } }
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0))
>bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18))
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts ===
export { X };
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 8))
export declare function foo(): X.bar;
>foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 13))
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0))
>bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts ===
declare module X { export interface bar { } }
>X : any
>bar : bar
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts ===
export { X };
>X : any
export declare function foo(): X.bar;
>foo : () => X.bar
>X : any
>bar : X.bar
@@ -0,0 +1,13 @@
tests/cases/compiler/exportSpecifierReferencingOuterDeclaration3.ts(6,30): error TS2305: Module 'X' has no exported member 'bar'.
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration3.ts (1 errors) ====
declare module X { export interface bar { } }
declare module "m" {
module X { export interface foo { } }
export { X };
export function foo(): X.foo;
export function bar(): X.bar; // error
~~~
!!! error TS2305: Module 'X' has no exported member 'bar'.
}
@@ -0,0 +1,10 @@
//// [exportSpecifierReferencingOuterDeclaration3.ts]
declare module X { export interface bar { } }
declare module "m" {
module X { export interface foo { } }
export { X };
export function foo(): X.foo;
export function bar(): X.bar; // error
}
//// [exportSpecifierReferencingOuterDeclaration3.js]
@@ -0,0 +1,13 @@
tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts(4,34): error TS2305: Module 'X' has no exported member 'bar'.
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts (0 errors) ====
declare module X { export interface bar { } }
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts (1 errors) ====
declare module X { export interface foo { } }
export { X };
export declare function foo(): X.foo;
export declare function bar(): X.bar; // error
~~~
!!! error TS2305: Module 'X' has no exported member 'bar'.
@@ -0,0 +1,13 @@
//// [tests/cases/compiler/exportSpecifierReferencingOuterDeclaration4.ts] ////
//// [exportSpecifierReferencingOuterDeclaration2_A.ts]
declare module X { export interface bar { } }
//// [exportSpecifierReferencingOuterDeclaration2_B.ts]
declare module X { export interface foo { } }
export { X };
export declare function foo(): X.foo;
export declare function bar(): X.bar; // error
//// [exportSpecifierReferencingOuterDeclaration2_A.js]
//// [exportSpecifierReferencingOuterDeclaration2_B.js]
@@ -0,0 +1,21 @@
//// [systemModule13.ts]
export let [x,y,z] = [1, 2, 3];
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
for ([x] of [[1]]) {}
//// [systemModule13.js]
System.register([], function(exports_1) {
var x, y, z, z0, z1;
return {
setters:[],
execute: function() {
_a = [1, 2, 3], exports_1("x", x = _a[0]), exports_1("y", y = _a[1]), exports_1("z", z = _a[2]);
_b = { a: true, b: { c: "123" } }, exports_1("z0", z0 = _b.a), exports_1("z1", z1 = _b.b.c);
for (var _i = 0, _c = [[1]]; _i < _c.length; _i++) {
exports_1("x", x = _c[_i][0]);
}
}
}
var _a, _b;
});
@@ -0,0 +1,17 @@
=== tests/cases/compiler/systemModule13.ts ===
export let [x,y,z] = [1, 2, 3];
>x : Symbol(x, Decl(systemModule13.ts, 1, 12))
>y : Symbol(y, Decl(systemModule13.ts, 1, 14))
>z : Symbol(z, Decl(systemModule13.ts, 1, 16))
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
>z0 : Symbol(z0, Decl(systemModule13.ts, 2, 14))
>z1 : Symbol(z1, Decl(systemModule13.ts, 2, 25))
>a : Symbol(a, Decl(systemModule13.ts, 2, 36))
>b : Symbol(b, Decl(systemModule13.ts, 2, 44))
>c : Symbol(c, Decl(systemModule13.ts, 2, 49))
for ([x] of [[1]]) {}
>x : Symbol(x, Decl(systemModule13.ts, 1, 12))
@@ -0,0 +1,32 @@
=== tests/cases/compiler/systemModule13.ts ===
export let [x,y,z] = [1, 2, 3];
>x : number
>y : number
>z : number
>[1, 2, 3] : [number, number, number]
>1 : number
>2 : number
>3 : number
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
>a : any
>z0 : boolean
>b : any
>c : any
>z1 : string
>{a: true, b: {c: "123"}} : { a: boolean; b: { c: string; }; }
>a : boolean
>true : boolean
>b : { c: string; }
>{c: "123"} : { c: string; }
>c : string
>"123" : string
for ([x] of [[1]]) {}
>[x] : number[]
>x : number
>[[1]] : number[][]
>[1] : number[]
>1 : number
@@ -1,42 +1,43 @@
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(15,12): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(22,33): error TS2304: Cannot find name 'x'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(26,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(27,5): error TS1131: Property or signature expected.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(28,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,38): error TS1225: Cannot find parameter 'x'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(34,51): error TS2322: Type 'B' is not assignable to type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(26,33): error TS1225: Cannot find parameter 'x'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(31,5): error TS1131: Property or signature expected.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(32,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(34,38): error TS1225: Cannot find parameter 'x'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(38,51): error TS2322: Type 'B' is not assignable to type 'A'.
Property 'propA' is missing in type 'B'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(38,56): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(42,56): error TS2322: Type 'T[]' is not assignable to type 'string'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(56,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(61,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(66,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(71,46): error TS2345: Argument of type '(p1: any) => boolean' is not assignable to parameter of type '(p1: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(42,56): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(46,56): error TS2322: Type 'T[]' is not assignable to type 'string'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(60,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(65,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(70,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(75,46): error TS2345: Argument of type '(p1: any) => boolean' is not assignable to parameter of type '(p1: any) => boolean'.
Type predicate 'p1 is C' is not assignable to 'p1 is B'.
Type 'C' is not assignable to type 'B'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(75,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(79,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
Signature '(p1: any, p2: any): boolean' must have a type predicate.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(81,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(85,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
Type predicate 'p2 is A' is not assignable to 'p1 is A'.
Parameter 'p2' is not in the same position as parameter 'p1'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(87,1): error TS2322: Type '(p1: any, p2: any, p3: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(92,9): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(93,16): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(94,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(100,25): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(101,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(103,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(106,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(107,16): error TS2408: Setters cannot return a value.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(112,18): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(116,22): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,20): error TS1229: A type predicate cannot reference a rest parameter.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(125,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(91,1): error TS2322: Type '(p1: any, p2: any, p3: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,9): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,16): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,25): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(107,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(110,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(111,16): error TS2408: Setters cannot return a value.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(116,18): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,22): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(124,20): error TS1229: A type predicate cannot reference a rest parameter.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(129,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,39): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (30 errors) ====
==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (31 errors) ====
class A {
propA: number;
@@ -66,6 +67,12 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,39
return true;
}
function hasMissingParameter(): x is A {
~
!!! error TS1225: Cannot find parameter 'x'.
return true;
}
function hasMissingTypeInTypeGuardType(x): x is {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
@@ -237,4 +244,10 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,39
~~
!!! error TS1230: A type predicate cannot reference element 'p1' in a binding pattern.
return true;
}
// Should not crash the compiler
var x: A;
if (hasMissingParameter()) {
x.propA;
}
@@ -24,6 +24,10 @@ function hasMissingIsKeyword(): x {
return true;
}
function hasMissingParameter(): x is A {
return true;
}
function hasMissingTypeInTypeGuardType(x): x is {
return true;
}
@@ -133,6 +137,12 @@ function b6([a, b, p1], p2, p3): p1 is A {
function b7({a, b, c: {p1}}, p2, p3): p1 is A {
return true;
}
// Should not crash the compiler
var x: A;
if (hasMissingParameter()) {
x.propA;
}
//// [typeGuardFunctionErrors.js]
@@ -167,6 +177,9 @@ function hasTypeGuardTypeInsideTypeGuardType(x) {
function hasMissingIsKeyword() {
return true;
}
function hasMissingParameter() {
return true;
}
return true;
function hasNonMatchingParameter(y) {
return true;
@@ -260,3 +273,8 @@ function b7(_a, p2, p3) {
var a = _a.a, b = _a.b, p1 = _a.c.p1;
return true;
}
// Should not crash the compiler
var x;
if (hasMissingParameter()) {
x.propA;
}
@@ -0,0 +1,3 @@
class C {
public {};
}
@@ -0,0 +1,3 @@
class C {
public {[name:string]:VariableDeclaration};
}
@@ -0,0 +1,12 @@
declare module "m2" {
export module X {
interface I { }
}
function Y();
export { Y as X };
function Z(): X.I;
}
declare module "m2" {
function Z2(): X.I;
}
@@ -0,0 +1,12 @@
declare module "m2" {
module X {
interface I { }
}
function Y();
export { Y as X };
function Z(): X.I;
}
declare module "m2" {
function Z2(): X.I;
}
@@ -0,0 +1,5 @@
declare module X { export interface bar { } }
declare module "m" {
export { X };
export function foo(): X.bar;
}
@@ -0,0 +1,7 @@
// @module: commonjs
// @Filename: exportSpecifierReferencingOuterDeclaration2_A.ts
declare module X { export interface bar { } }
// @Filename: exportSpecifierReferencingOuterDeclaration2_B.ts
export { X };
export declare function foo(): X.bar;
@@ -0,0 +1,7 @@
declare module X { export interface bar { } }
declare module "m" {
module X { export interface foo { } }
export { X };
export function foo(): X.foo;
export function bar(): X.bar; // error
}
@@ -0,0 +1,9 @@
// @module: commonjs
// @Filename: exportSpecifierReferencingOuterDeclaration2_A.ts
declare module X { export interface bar { } }
// @Filename: exportSpecifierReferencingOuterDeclaration2_B.ts
declare module X { export interface foo { } }
export { X };
export declare function foo(): X.foo;
export declare function bar(): X.bar; // error
+5
View File
@@ -0,0 +1,5 @@
// @module: system
export let [x,y,z] = [1, 2, 3];
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
for ([x] of [[1]]) {}
@@ -23,6 +23,10 @@ function hasMissingIsKeyword(): x {
return true;
}
function hasMissingParameter(): x is A {
return true;
}
function hasMissingTypeInTypeGuardType(x): x is {
return true;
}
@@ -132,4 +136,10 @@ function b6([a, b, p1], p2, p3): p1 is A {
function b7({a, b, c: {p1}}, p2, p3): p1 is A {
return true;
}
// Should not crash the compiler
var x: A;
if (hasMissingParameter()) {
x.propA;
}
@@ -713,6 +713,24 @@ module m3 { }\
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4);
});
it('Do not move constructors from class to object-literal.', () => {
var source = "class C { public constructor() { } public constructor() { } public constructor() { } }"
var oldText = ScriptSnapshot.fromString(source);
var newTextAndChange = withChange(oldText, 0, "class C".length, "var v =");
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0);
});
it('Do not move methods called "constructor" from object literal to class', () => {
var source = "var v = { public constructor() { } public constructor() { } public constructor() { } }"
var oldText = ScriptSnapshot.fromString(source);
var newTextAndChange = withChange(oldText, 0, "var v =".length, "class C");
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 0);
});
it('Moving index signatures from class to interface',() => {
var source = "class C { public [a: number]: string; public [a: number]: string; public [a: number]: string }"
+1
View File
@@ -68,6 +68,7 @@ var x = 0;`,
`});\n`;
runTest("var x = 1;", { module: ModuleKind.System, newLine: NewLineKind.LineFeed }, /*fileName*/ undefined, "NamedModule", output)
});
it("No extra errors for file without extension", () => {
runTest(`var x = 0;`, { module: ModuleKind.CommonJS }, "file", /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/[]);
});