Skip to content
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

Constraints of functions passed as argument are not checked #14766

Closed
gcnew opened this issue Mar 21, 2017 · 4 comments
Closed

Constraints of functions passed as argument are not checked #14766

gcnew opened this issue Mar 21, 2017 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@gcnew
Copy link
Contributor

gcnew commented Mar 21, 2017

TypeScript Version: nightly

Code

declare function p(x: 'hello'): 'hello';
declare function g<T extends string>(x: T): T;

declare function h(f: (x: number) => number): number;
declare function f<T extends number>(f: (x: T) => T): T;

h(p); // Error as expected
h(g); // Uncaught error
f(g); // Uncaught error

Expected behavior:
All of the above invokations should be errors.

@zpdDG4gta8XKpMCd
Copy link

might be related: #13039 (comment)

@gcnew
Copy link
Contributor Author

gcnew commented Mar 21, 2017

@Aleksey-Bykov Thanks. Yes, it is a duplicate of #3410. I'll still leave it open to see if the attitude towards this problem has changed.

@zpdDG4gta8XKpMCd
Copy link

i am with you let the duplicates rain!

@gcnew
Copy link
Contributor Author

gcnew commented Mar 21, 2017

I've changed my mind, closing 😄

@gcnew gcnew closed this as completed Mar 21, 2017
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 21, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants