Last active
September 6, 2017 15:53
-
-
Save willfrew/d6036d257e3c444305b6ff71ef487c08 to your computer and use it in GitHub Desktop.
Typescript 2.4.0+ Stack overflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Foo<T> { | |
(bar: Bar<T>): void; | |
} | |
export interface Bar<T> { | |
(foo: Foo<T>): Foo<T>; | |
} | |
function createBar<T>(): Bar<T> { | |
return (f) => f; | |
} | |
function foo<T>( | |
bar: Bar<T>, | |
): void {} | |
// Operator '===' cannot be applied to types 'Foo<{}>' and 'string'. | |
createBar()(foo) === '1'; | |
// Operator '===' cannot be applied to types '<T>(bar?: Bar<T>) => void' and 'number' | |
foo === 1; | |
// Stack overflow | |
createBar()(foo) === foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment