-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixedFixedA PR has been merged for this issueA PR has been merged for this issue
Description
TypeScript Version: 3.4.0-dev.20190326
Search Terms: Function Generic Extends Keyof Property
Code
interface Type {
a: 123;
b: "some string";
}
function get123<K extends keyof Type>(): Type[K] {
return 123;
}
Expected behavior:
The function get123
would yield an error as the return type might not be correct as it depends on K
.
Actual behavior:
No error for get123
. That function would obviously always return 123.
Playground Link: Example on TypeScript Playground
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixedFixedA PR has been merged for this issueA PR has been merged for this issue