mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix #4194: emit type paramters in type alias declaration
This commit is contained in:
parent
ba7759227b
commit
fbba50b312
@ -754,6 +754,7 @@ namespace ts {
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("type ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
emitTypeParameters(node.typeParameters);
|
||||
write(" = ");
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
|
||||
@ -1786,10 +1786,10 @@ namespace ts {
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
UnionOrIntersection = Union | Intersection,
|
||||
StructuredType = ObjectType | Union | Intersection,
|
||||
/* @internal */
|
||||
/* @internal */
|
||||
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral,
|
||||
/* @internal */
|
||||
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
|
||||
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
|
||||
14
tests/baselines/reference/typeAliasDeclarationEmit.js
Normal file
14
tests/baselines/reference/typeAliasDeclarationEmit.js
Normal file
@ -0,0 +1,14 @@
|
||||
//// [typeAliasDeclarationEmit.ts]
|
||||
|
||||
export type callback<T> = () => T;
|
||||
|
||||
export type CallbackArray<T extends callback> = () => T;
|
||||
|
||||
//// [typeAliasDeclarationEmit.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
|
||||
|
||||
//// [typeAliasDeclarationEmit.d.ts]
|
||||
export declare type callback<T> = () => T;
|
||||
export declare type CallbackArray<T extends callback> = () => T;
|
||||
13
tests/baselines/reference/typeAliasDeclarationEmit.symbols
Normal file
13
tests/baselines/reference/typeAliasDeclarationEmit.symbols
Normal file
@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/typeAliasDeclarationEmit.ts ===
|
||||
|
||||
export type callback<T> = () => T;
|
||||
>callback : Symbol(callback, Decl(typeAliasDeclarationEmit.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(typeAliasDeclarationEmit.ts, 1, 21))
|
||||
>T : Symbol(T, Decl(typeAliasDeclarationEmit.ts, 1, 21))
|
||||
|
||||
export type CallbackArray<T extends callback> = () => T;
|
||||
>CallbackArray : Symbol(CallbackArray, Decl(typeAliasDeclarationEmit.ts, 1, 34))
|
||||
>T : Symbol(T, Decl(typeAliasDeclarationEmit.ts, 3, 26))
|
||||
>callback : Symbol(callback, Decl(typeAliasDeclarationEmit.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(typeAliasDeclarationEmit.ts, 3, 26))
|
||||
|
||||
13
tests/baselines/reference/typeAliasDeclarationEmit.types
Normal file
13
tests/baselines/reference/typeAliasDeclarationEmit.types
Normal file
@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/typeAliasDeclarationEmit.ts ===
|
||||
|
||||
export type callback<T> = () => T;
|
||||
>callback : () => T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
export type CallbackArray<T extends callback> = () => T;
|
||||
>CallbackArray : () => T
|
||||
>T : T
|
||||
>callback : () => T
|
||||
>T : T
|
||||
|
||||
7
tests/cases/compiler/typeAliasDeclarationEmit.ts
Normal file
7
tests/cases/compiler/typeAliasDeclarationEmit.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// @target: ES5
|
||||
// @module: AMD
|
||||
// @declaration: true
|
||||
|
||||
export type callback<T> = () => T;
|
||||
|
||||
export type CallbackArray<T extends callback> = () => T;
|
||||
Loading…
x
Reference in New Issue
Block a user