#Possible to get BigInt type literals?

8 messages · Page 1 of 1 (latest)

calm laurel
#
// I can do this
const foo = (x: bigint) => ...
// But I would like to do this:
const bar = (x: 0n | 1n | 2n) => ...
ebon ridge
#

did you try it?

#

you can do it

calm laurel
# ebon ridge you can do it

Right you are, I was concerned because the documentation said literal types were only for strings and number (without mentioning the other primitives)

#

How to mark as resolved?

ebon ridge
#

!resolved

calm laurel
#

!resolved

ebon ridge
#

you can use the playground to test if you don't want to set up a project, btw.