- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.4.2 / Typescript playground
Code
export interface Storage {
    getItem<T>(onComplete?: OnComplete<T>): Promise<T>;
}
export type OnComplete<T> = (err?: any, result?: T) => any;
let storage: Storage = {
    getItem: (onComplete: OnComplete<string>) => {
        return Promise.resolve("Yay");
    }
};Expected behavior:
Code snippet above works
Actual behavior:
Ultimately, string is not assignable to type T on Typescript playground. On 2.4.2, I get string is not assignable to T | undefined. Both makes no sense...
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug