File tree Expand file tree Collapse file tree 4 files changed +51
-2
lines changed Expand file tree Collapse file tree 4 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -1575,7 +1575,6 @@ module ts {
15751575 case SyntaxKind.IndexSignature:
15761576 case SyntaxKind.Parameter:
15771577 case SyntaxKind.ModuleBlock:
1578- case SyntaxKind.TypeParameter:
15791578 case SyntaxKind.FunctionType:
15801579 case SyntaxKind.ConstructorType:
15811580 case SyntaxKind.TypeLiteral:
@@ -1585,7 +1584,9 @@ module ts {
15851584 case SyntaxKind.UnionType:
15861585 case SyntaxKind.ParenthesizedType:
15871586 return isDeclarationVisible(<Declaration>node.parent);
1588-
1587+
1588+ // Type parameters are always visible
1589+ case SyntaxKind.TypeParameter:
15891590 // Source file is always visible
15901591 case SyntaxKind.SourceFile:
15911592 return true;
Original file line number Diff line number Diff line change 1+ //// [visibilityOfTypeParameters.ts]
2+
3+ export class MyClass {
4+ protected myMethod < T > ( val : T ) : T {
5+ return val ;
6+ }
7+ }
8+
9+ //// [visibilityOfTypeParameters.js]
10+ var MyClass = ( function ( ) {
11+ function MyClass ( ) {
12+ }
13+ MyClass . prototype . myMethod = function ( val ) {
14+ return val ;
15+ } ;
16+ return MyClass ;
17+ } ) ( ) ;
18+ exports . MyClass = MyClass ;
19+
20+
21+ //// [visibilityOfTypeParameters.d.ts]
22+ export declare class MyClass {
23+ protected myMethod < T > ( val : T ) : T ;
24+ }
Original file line number Diff line number Diff line change 1+ === tests/cases/compiler/visibilityOfTypeParameters.ts ===
2+
3+ export class MyClass {
4+ >MyClass : MyClass
5+
6+ protected myMethod<T>(val: T): T {
7+ >myMethod : <T>(val: T) => T
8+ >T : T
9+ >val : T
10+ >T : T
11+ >T : T
12+
13+ return val;
14+ >val : T
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ // @module :commonjs
2+ //@declaration : true
3+
4+ export class MyClass {
5+ protected myMethod < T > ( val : T ) : T {
6+ return val ;
7+ }
8+ }
You can’t perform that action at this time.
0 commit comments