TypeScript --noImplicitAny is not enough!
Last active
April 26, 2016 00:13
-
-
Save overminder/b4ea8f38eb46aaa2a9c3d4ce915cb505 to your computer and use it in GitHub Desktop.
This file contains 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
function makeConsumer<A>(): (a: A) => void { | |
return (a: A) => console.log(a); | |
} | |
function dealWithTwoThings<A, B>(a: A, b: B) { | |
// This function compiles under 1.8.9 since tsc infers `consumer` to be `(a: {}) => void`. | |
// I feel that it should be an error as I obviously forgot to write the type parameter for | |
// the invocation of `makeConsumer` here. | |
const consumer = makeConsumer(); | |
consumer(a); | |
consumer(b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment