-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
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)
Bludator
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed