Handel assert for missing node kind in isDeclarationVisible for functionType and constructorType

This commit is contained in:
Mohamed Hegazy 2014-11-30 11:04:15 -08:00
parent d1bf508a7b
commit 9ed27b23ab
7 changed files with 107 additions and 0 deletions

View file

@ -1617,7 +1617,9 @@ module ts {
case SyntaxKind.Constructor:
case SyntaxKind.ConstructSignature:
case SyntaxKind.ConstructorType:
case SyntaxKind.CallSignature:
case SyntaxKind.FunctionType:
case SyntaxKind.IndexSignature:
case SyntaxKind.Parameter:
case SyntaxKind.ModuleBlock:

View file

@ -0,0 +1,22 @@
//// [constructorTypeDeclarations.ts]
module schema {
export function createValidator(schema: any): new <T>(data: T) => T {
return undefined;
}
}
//// [constructorTypeDeclarations.js]
var schema;
(function (_schema) {
function createValidator(schema) {
return undefined;
}
_schema.createValidator = createValidator;
})(schema || (schema = {}));
//// [constructorTypeDeclarations.d.ts]
declare module schema {
function createValidator(schema: any): new <T>(data: T) => T;
}

View file

@ -0,0 +1,17 @@
=== tests/cases/compiler/constructorTypeDeclarations.ts ===
module schema {
>schema : typeof schema
export function createValidator(schema: any): new <T>(data: T) => T {
>createValidator : (schema: any) => new <T>(data: T) => T
>schema : any
>T : T
>data : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}

View file

@ -0,0 +1,26 @@
//// [functionTypeDeclarations.ts]
module schema {
export function createValidator(schema: any): <T>(data: T) => T {
return <T>(data: T) => {
return data;
}
}
}
//// [functionTypeDeclarations.js]
var schema;
(function (_schema) {
function createValidator(schema) {
return function (data) {
return data;
};
}
_schema.createValidator = createValidator;
})(schema || (schema = {}));
//// [functionTypeDeclarations.d.ts]
declare module schema {
function createValidator(schema: any): <T>(data: T) => T;
}

View file

@ -0,0 +1,24 @@
=== tests/cases/compiler/functionTypeDeclarations.ts ===
module schema {
>schema : typeof schema
export function createValidator(schema: any): <T>(data: T) => T {
>createValidator : (schema: any) => <T>(data: T) => T
>schema : any
>T : T
>data : T
>T : T
>T : T
return <T>(data: T) => {
><T>(data: T) => { return data; } : <T>(data: T) => T
>T : T
>data : T
>T : T
return data;
>data : T
}
}
}

View file

@ -0,0 +1,7 @@
// @declaration: true
module schema {
export function createValidator(schema: any): new <T>(data: T) => T {
return undefined;
}
}

View file

@ -0,0 +1,9 @@
// @declaration: true
module schema {
export function createValidator(schema: any): <T>(data: T) => T {
return <T>(data: T) => {
return data;
}
}
}