-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
π Search Terms
setter, getter, infer
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about Conditional Types
β― Playground Link
π» Code
interface Test1 {
get prop(): string;
set prop(v: string | number);
}
type SetterType<T, K extends keyof T> = T extends {set [P in K](v: infer U);} ? U : T[K];
declare const setter: SetterType<Test1, 'prop'>; // unknown π Actual behavior
Hovering on setter gives you
const setter: unknownπ Expected behavior
Hovering on setter gives you
const setter: string | numberMetadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue