Skip to content
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

Overload signature in method completion missing any return type annotation #57644

Open
gabritto opened this issue Mar 5, 2024 · 1 comment
Open
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@gabritto
Copy link
Member

gabritto commented Mar 5, 2024

πŸ”Ž Search Terms

overload method completion

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

No response

πŸ’» Code

class Foo {
    foo(a: string): string;
    foo(a: number): number;
    foo(a: any): any {
        return a;
    }
}

class Bar extends Foo {
    f|
}

πŸ™ Actual behavior

If you select method completion for foo, you get:

class Foo {
    foo(a: string): string;
    foo(a: number): number;
    foo(a: any): any {
        return a;
    }
}

class Bar extends Foo {
    foo(a: string): string;
    foo(a: number): number;
    foo(a: any) {
        
    }
}

There is an error on foo(a: string): string;:
"This overload signature is not compatible with its implementation signature. ts(2394)"

πŸ™‚ Expected behavior

If you select method completion for foo, you get:

class Foo {
    foo(a: string): string;
    foo(a: number): number;
    foo(a: any): any {
        return a;
    }
}

class Bar extends Foo {
    foo(a: string): string;
    foo(a: number): number;
    foo(a: any): any {
        
    }
}

And no errors.

Additional information about the issue

No response

@gabritto
Copy link
Member Author

gabritto commented Mar 5, 2024

Note: we choose to omit the any return type here.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Mar 6, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

2 participants