You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interface Obj {
foo: number
bar: string
baz: number
}
type Sub = Omit<Obj, "baz">
const obj: Obj = {foo: 1, bar: "abc", baz: 1}
function fn (key: K, val: Sub[K]) {
obj[key] = val
}
π Actual behavior
Typescript should(?) have inferred the data type like it did without the utility type, but is requiring that data types be uniform on the utility type.
π Expected behavior
The compiler to still be able to compute the data type
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
Signature Index with Utility Types
π Version & Regression Information
This happened with all versions I've tested including nightly
β― Playground Link
I don't have a playground link unfortunately, except my stackoverflow question:
https://stackoverflow.com/questions/67542115/typescript-compiler-failing-with-different-property-types-on-omit-and-index-sign/67542334
π» Code
interface Obj {
foo: number
bar: string
baz: number
}
type Sub = Omit<Obj, "baz">
const obj: Obj = {foo: 1, bar: "abc", baz: 1}
function fn (key: K, val: Sub[K]) {
obj[key] = val
}
π Actual behavior
Typescript should(?) have inferred the data type like it did without the utility type, but is requiring that data types be uniform on the utility type.
π Expected behavior
The compiler to still be able to compute the data type
The text was updated successfully, but these errors were encountered: