Created
December 15, 2021 20:32
-
-
Save Dremora/945af2ab3a3daa8e6298301290d494e6 to your computer and use it in GitHub Desktop.
TypeScript runtime error due to the lack of exact types
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: 1, b : {}} | |
const bar: { a: number} = foo; | |
const baz: { [a: string]: number} = bar; | |
const b = baz['b']; | |
if (typeof b !== 'undefined') { | |
console.log(b.toFixed(2)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment