mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #1614 from Microsoft/type_parameters_visibility
consider type parameters always visible
This commit is contained in:
commit
4daa107cb4
@ -1575,7 +1575,6 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
@ -1585,7 +1584,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