- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.3.2
Code
{
    const fn = (): Promise<number> => {
        const innerFn = async () => {
            if (1 === 1) {
                return Promise.resolve('wrong type');
            } else {
                return Promise.resolve(1);
            }
        };
        // should error with `Type 'string' is not assignable to type 'number'.`
        return innerFn();
    };
    fn();
}Expected behavior:
return innerFn() should error with Type 'string' is not assignable to type 'number'.
Actual behavior:
return innerFn() does not error.
If you remove the async keyword from the async function, the program type checks as expected:
{
    const fn = (): Promise<number> => {
        const innerFn = () => {
            if (1 === 1) {
                return Promise.resolve('wrong type');
            } else {
                return Promise.resolve(1);
            }
        };
        return innerFn();
    };
    fn();
}Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created