Created
November 12, 2022 20:17
-
-
Save dioxmio/2f878a5221dd2d48e7a98cb48f43ee19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const foo = { | |
a: 255, | |
b: 255, | |
c: 255, | |
// ❌ We get the error Type 'string' is not assignable to type 'number' | |
d: 'bar' | |
} satisfies Record<string, number>; | |
// ✅ We are not loosing any type inferance information | |
// typeof foo is | |
// const foo: { | |
// a: number; | |
// b: number; | |
// c: number; | |
// d: string; | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment