-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Open
Description
π Search Terms
implicit any contextual type
π Version & Regression Information
- This changed between versions 5.9.3 and 6.0 - rc
β― Playground Link
π» Code
declare let x: { function: string }
export type AssertableState<T> = {
[P in keyof T as P]: (value: T[P]) => void;
}
declare function assert_state<T extends object>(o: T, state: AssertableState<T>): void;
assert_state(x, {
function: v => { } // v is string
})
declare function assert_state_bad<T extends object>(o: T, state: Omit<AssertableState<T>, "">): void;
assert_state_bad(x, {
function: v => { } // error - v is implictly any
})π Actual behavior
The call to assert_state_bad fails because v is implicitly typed as any
π Expected behavior
Either should pass as in 5.9.3
Additional information about the issue
- Works without the
Omit - Works without the
as Pin the mapped type. (original mapping was more complicated, but identity mapping seems to trigger it too)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels