Skip to content

TS3.7: No overload matches this call #34554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eamodio opened this issue Oct 18, 2019 · 3 comments
Closed

TS3.7: No overload matches this call #34554

eamodio opened this issue Oct 18, 2019 · 3 comments

Comments

@eamodio
Copy link

eamodio commented Oct 18, 2019

TypeScript Version: 3.7.0-dev.20191017

Search Terms:
No overload matches this call.

Code

class Repo {
    async getLastFetched(): Promise<number> {
        try {
            return await new Date().getTime();
        }
        catch {
            return 0;
        }
    }

    async getStatus(): Promise<{ status: number } | undefined> {
        return await { status: 0 };
    }
}

class Foo {
    private async getSingleRepoConfirmStep(repos: Repo[]) {
        const repo = repos[0];
        const [status, lastFetched] = await Promise.all([repo.getStatus(), repo.getLastFetched()]);

        let fetchedOn = ''
        if (lastFetched !== 0 && status !== undefined) {
            const goo = `${status.status}`;
            fetchedOn = `Last fetched ${new Date(lastFetched)}`;
        }
    }
}

Expected behavior:
lastFetched is of type number

Actual behavior:
lastFetched is of type number | undefined

Playground Link:
https://www.typescriptlang.org/play/index.html?ts=Nightly#code/MYGwhgzhAEBKCmAHA9tA3gKGt6kCeAdsNAObwAuAMpOQGIXAAW8AJgBQCUAXNAAoBOyALYBLCPAA8BAK5CARvH4A+dFhzry-PKvW6c-CtP4FcAdzAjy0AvFPQAImHLxOAOjLkAKiKEuOAbjU9AF8g3WAnJh09XQNyIxMABkCY6FD1ULD8IlIKAGVyJ2kITh4BYTFJNGgIQviIHhl5RTToAB9oaQIWeAAzERsWFUxUuISzCytq2qKG6ES0lJxQzNBIGFpkVBGcRH4RADcneFwIQmIPPIGSEHgEFABhZAJ+-iECpDYDFDn75ABtAC6HGiemAz1q0G+qAAvFCkMgIP9EoClmCIVZ-jN6gAaaDgWr0chMViA6BwsDmSx8QSicSuMAgEBsf7Q9z5OrFTh4tkeaiEhjMdgcYGBMLqW5WXqC1gAeRMcIA5IrxTgRL1oGwCXQZSxoABCGFwhYAMhNNU5MENcK6PX6gxBO1S2HBBEhJC25OgAAMACRobHFVyBiDBb1o53S4lC+Ve738qW66D+mx2RzOLU0IkklgcMMRjJhFZAA

Related Issues:

@AviVahl
Copy link

AviVahl commented Oct 18, 2019

Might be fixed by #34501
?

@AviVahl
Copy link

AviVahl commented Oct 18, 2019

#33752

@eamodio
Copy link
Author

eamodio commented Oct 24, 2019

Closing at duplicate of #33752

@eamodio eamodio closed this as completed Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants