Add constructor case

This commit is contained in:
Wesley Wigham 2018-11-30 17:44:25 -08:00
parent fa8df0d32c
commit cd6fdb11d6
6 changed files with 21 additions and 1 deletions

View file

@ -389,6 +389,7 @@ namespace ts {
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.ConstructorType:
case SyntaxKind.ConstructSignature:
diagnosticMessage = Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;

View file

@ -1,13 +1,20 @@
tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(2,27): error TS2304: Cannot find name 'T2'.
tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(2,27): error TS4016: Type parameter 'T1' of exported function has or is using private name 'T2'.
tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(3,33): error TS2304: Cannot find name 'T2'.
tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(3,33): error TS4006: Type parameter 'T1' of constructor signature from exported interface has or is using private name 'T2'.
==== tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts (2 errors) ====
==== tests/cases/compiler/declarationEmitLambdaWithMissingTypeParameterNoCrash.ts (4 errors) ====
export interface Foo {
preFetch: <T1 extends T2> (c: T1) => void; // Type T2 is not defined
~~
!!! error TS2304: Cannot find name 'T2'.
~~
!!! error TS4016: Type parameter 'T1' of exported function has or is using private name 'T2'.
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined
~~
!!! error TS2304: Cannot find name 'T2'.
~~
!!! error TS4006: Type parameter 'T1' of constructor signature from exported interface has or is using private name 'T2'.
}

View file

@ -1,6 +1,7 @@
//// [declarationEmitLambdaWithMissingTypeParameterNoCrash.ts]
export interface Foo {
preFetch: <T1 extends T2> (c: T1) => void; // Type T2 is not defined
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined
}

View file

@ -7,5 +7,11 @@ export interface Foo {
>T1 : Symbol(T1, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 1, 15))
>c : Symbol(c, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 1, 31))
>T1 : Symbol(T1, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 1, 15))
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined
>preFetcher : Symbol(Foo.preFetcher, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 1, 46))
>T1 : Symbol(T1, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 2, 21))
>c : Symbol(c, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 2, 37))
>T1 : Symbol(T1, Decl(declarationEmitLambdaWithMissingTypeParameterNoCrash.ts, 2, 21))
}

View file

@ -2,6 +2,10 @@
export interface Foo {
preFetch: <T1 extends T2> (c: T1) => void; // Type T2 is not defined
>preFetch : <T1 extends any>(c: T1) => void
>c : T1
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined
>preFetcher : new <T1 extends any>(c: T1) => void
>c : T1
}

View file

@ -1,4 +1,5 @@
// @declaration: true
export interface Foo {
preFetch: <T1 extends T2> (c: T1) => void; // Type T2 is not defined
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined
}