Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don’t get this? why do I need to say as const?


`as const` is a special annotation that lets the TypeScript compiler infers the more specific type `["foo"]` instead of `string[]`.


As const creates a typed tuple instead of a typed array




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: