Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
jbbe
4y ago
0 comments
Share
I often use that approach but (especially when you're importing from a seperate package) the compiler will sometimes view MyType as just an alias for string and won't catch typos.
Am I missing something in how to use this?
0 comments
default
newest
oldest
Recursing
4y ago
`as const` is the important bit there, see this playground link
https://www.typescriptlang.org/play?#code/MYewdgzgLgBKlQIICd...
j
/
k
navigate · click thread line to collapse