Closed
Description
openedon Jan 8, 2019
TypeScript Version: 3.1.6
Search Terms: overload function generic
Code
declare function identity <T extends unknown>(t: T): T
declare function identity (): undefined
declare class Option<A> {
chain<B>(f: (a: A) => Option<B>): Option<B>;
}
// Actual type: <T>(option: Option<Option<T>>) => Option<{}>
// Expected type: <T>(option: Option<Option<T>>) => Option<T>
// Disabling second `identity` overload fixes it for some reason.
const optionFlatten = <T>(option: Option<Option<T>>) => option.chain(identity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment