Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
cat-whisperer
3 months ago
|
parent
|
context
|
favorite
| on:
Unconventional Ways to Cast in TypeScript
I don’t get this? why do I need to say as const?
afdbcreid
3 months ago
|
next
[–]
`as const` is a special annotation that lets the TypeScript compiler infers the more specific type `["foo"]` instead of `string[]`.
halflife
3 months ago
|
prev
[–]
As const creates a typed tuple instead of a typed array
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: