Skip to content

Overloads with single string literal type gives assignability errors #6732

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
zhengbli opened this issue Jan 29, 2016 · 1 comment · Fixed by #6278
Closed

Overloads with single string literal type gives assignability errors #6732

zhengbli opened this issue Jan 29, 2016 · 1 comment · Fixed by #6278
Labels
Bug A bug in TypeScript

Comments

@zhengbli
Copy link
Contributor

Sample code:

interface Base {
    foo(p1: string, p2: string): void;
}

interface T extends Base {
    foo(p1: "p1" | "p2", p2: string): void; // Pass
}

interface T2 extends Base {
    foo(p1: "p3", p2: string): void; // Error: Specialized overload signature is not assignable to any non-specialized signature
}

Maybe related: #6272, however this seems stricter instead of looser

@DanielRosenwasser
Copy link
Member

This is unrelated to #6272, but we determined offline that we should fix this. #6278 has the fix.

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Jan 30, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants