mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
consider type parameters always visible
This commit is contained in:
parent
58073e769d
commit
1ebf90561b
@ -1587,7 +1587,6 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
@ -1597,7 +1596,9 @@ module ts {
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return isDeclarationVisible(<Declaration>node.parent);
|
||||
|
||||
|
||||
// Type parameters are always visible
|
||||
case SyntaxKind.TypeParameter:
|
||||
// Source file is always visible
|
||||
case SyntaxKind.SourceFile:
|
||||
return true;
|
||||
|
||||
24
tests/baselines/reference/visibilityOfTypeParameters.js
Normal file
24
tests/baselines/reference/visibilityOfTypeParameters.js
Normal file
@ -0,0 +1,24 @@
|
||||
//// [visibilityOfTypeParameters.ts]
|
||||
|
||||
export class MyClass {
|
||||
protected myMethod<T>(val: T): T {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
//// [visibilityOfTypeParameters.js]
|
||||
var MyClass = (function () {
|
||||
function MyClass() {
|
||||
}
|
||||
MyClass.prototype.myMethod = function (val) {
|
||||
return val;
|
||||
};
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
|
||||
|
||||
//// [visibilityOfTypeParameters.d.ts]
|
||||
export declare class MyClass {
|
||||
protected myMethod<T>(val: T): T;
|
||||
}
|
||||
16
tests/baselines/reference/visibilityOfTypeParameters.types
Normal file
16
tests/baselines/reference/visibilityOfTypeParameters.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/visibilityOfTypeParameters.ts ===
|
||||
|
||||
export class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
protected myMethod<T>(val: T): T {
|
||||
>myMethod : <T>(val: T) => T
|
||||
>T : T
|
||||
>val : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return val;
|
||||
>val : T
|
||||
}
|
||||
}
|
||||
8
tests/cases/compiler/visibilityOfTypeParameters.ts
Normal file
8
tests/cases/compiler/visibilityOfTypeParameters.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// @module:commonjs
|
||||
//@declaration: true
|
||||
|
||||
export class MyClass {
|
||||
protected myMethod<T>(val: T): T {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user