Created
July 18, 2020 02:26
-
-
Save ikhsanalatsary/48952e1ca3321bcb6e88c3c6274b219e to your computer and use it in GitHub Desktop.
Typecasting Example 2
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
let someValue: any = "this is a string"; | |
let strLength: number = (someValue as string).length; | |
// konversi object ke readonly (immutable diwaktu kompile) | |
let obj = { key: 'value' } as const | |
obj.key = 3; // error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment