mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix #4159: look up the type alias paramter within the context of the parent type alias declaration
This commit is contained in:
parent
fbba50b312
commit
d58ec43b3f
@ -750,6 +750,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
function writeTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("type ");
|
||||
@ -759,6 +761,7 @@ namespace ts {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
|
||||
function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
return {
|
||||
|
||||
13
tests/baselines/reference/typeAliasDeclarationEmit2.js
Normal file
13
tests/baselines/reference/typeAliasDeclarationEmit2.js
Normal file
@ -0,0 +1,13 @@
|
||||
//// [typeAliasDeclarationEmit2.ts]
|
||||
|
||||
export type A<a> = { value: a };
|
||||
|
||||
//// [typeAliasDeclarationEmit2.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
|
||||
|
||||
//// [typeAliasDeclarationEmit2.d.ts]
|
||||
export declare type A<a> = {
|
||||
value: a;
|
||||
};
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/typeAliasDeclarationEmit2.ts ===
|
||||
|
||||
export type A<a> = { value: a };
|
||||
>A : Symbol(A, Decl(typeAliasDeclarationEmit2.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(typeAliasDeclarationEmit2.ts, 1, 14))
|
||||
>value : Symbol(value, Decl(typeAliasDeclarationEmit2.ts, 1, 20))
|
||||
>a : Symbol(a, Decl(typeAliasDeclarationEmit2.ts, 1, 14))
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/typeAliasDeclarationEmit2.ts ===
|
||||
|
||||
export type A<a> = { value: a };
|
||||
>A : { value: a; }
|
||||
>a : a
|
||||
>value : a
|
||||
>a : a
|
||||
|
||||
5
tests/cases/compiler/typeAliasDeclarationEmit2.ts
Normal file
5
tests/cases/compiler/typeAliasDeclarationEmit2.ts
Normal file
@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @module: AMD
|
||||
// @declaration: true
|
||||
|
||||
export type A<a> = { value: a };
|
||||
Loading…
x
Reference in New Issue
Block a user