Skip to content

Interface cannot override predicate return type with booleanΒ #58202

@mjbvz

Description

@mjbvz

πŸ”Ž Search Terms

  • must be a type predicate

πŸ•— Version & Regression Information

  • This is a crash
  • This changed between versions 5.4.5 and 5.5.0-dev.20240415

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.5.0-dev.20240415#code/JYOwLgpgTgZghgYwgAgGIHt3IN4CgCQwAzhugBQAeAXMnCAJ4CUNYAFsch6QNy4C+uXKEixEKAEJwoyCBUggAJkTSYcBYqUo06TFlACuEXsj5A

πŸ’» Code

interface Foo {
	isFoo(x: any): this is Foo;
}

interface Bar extends Foo {
	isFoo(x: any): true;
}

πŸ™ Actual behavior

In bar, see:

Signature '(x: any): true' must be a type predicate

πŸ™‚ Expected behavior

No error

Additional information about the issue

Encountering this in the VS Code repo. Seems like an unexpected regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions