Skip to content

Declaration emit for function parameter type references incorrect type alias #12343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vsiao opened this issue Nov 18, 2016 · 2 comments
Closed

Comments

@vsiao
Copy link

vsiao commented Nov 18, 2016

TypeScript Version: 2.0.10 (broken since 2.0.2).

Code

export type Foo<A, B> = A | B;
export type Bar<T> = Foo<number, T>;

export const f = <T>(bar: Bar<T>) => {
    return true;
};

Expected behavior:
tsc --declaration bar.ts should emit the following bar.d.ts:

export declare type Foo<A, B> = A | B;
export declare type Bar<T> = Foo<number, T>;
export declare const f: <T>(bar: Bar<T>) => boolean;

NB: 2.0.0 emits <T>(bar: number | T) => boolean, which is acceptable too.

Actual behavior:

export declare type Foo<A, B> = A | B;
export declare type Bar<T> = Foo<number, T>;
export declare const f: <T>(bar: Foo<T>) => boolean; 
// TS2314: Generic type 'Foo' requires 2 type argument(s).
@vsiao
Copy link
Author

vsiao commented Nov 18, 2016

ah, sorry—looks like this was fixed for 2.1: #11931

@vsiao vsiao closed this as completed Nov 18, 2016
@vsiao
Copy link
Author

vsiao commented Nov 18, 2016

Looks good in nightly, but still broken in 2.1.1 (RC). @mhegazy can you confirm which release the fix will be in?

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant