Created
September 8, 2023 01:09
-
-
Save edezekiel/6375fc2eb01e690bbfc5c45c9a102695 to your computer and use it in GitHub Desktop.
Type safety issues when using Record<string, any>
This file contains 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
function parseObject(obj: Record<string, any>) { | |
let doesNotExist = obj['doesNotExist']; // ok maybe it's not so bad | |
doesNotExist.toString(); // yikes | |
doesNotExist += 100; // double yikes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment