-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
I've run into a mysterious case with a return-type that is clearly wrong - in methods like this one:
interface Foo {
a: string
b: number
}
class Hello {
getFoo(): Promise<Foo> {
return Promise.resolve("a string")
}
}
The declared return-type in this example is Promise<Foo>, but the function returns Promise<string>, yet there is no notice/warning/error for this - it compiles without complaint.
In fact, it doesn't matter what I put in that return type-hint - I can return whatever I want, not just Promises, but any unrelated type, anything goes.
Is this really working as intended? What gives?
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created