A
arktype•2y ago
san

Record type?

Hello! Is there a way to create a Record type?
2 Replies
TizzySaurus
TizzySaurus•2y ago
There will be in the beta! I guess atm you just have to use a morph... if that would work 🤔 This is a sample implementation from the looks of it: https://discord.com/channels/957797212103016458/1113097339746398309/1113097529307971595
ssalbdivad
ssalbdivad•2y ago
Thanks @TizzySaurus. Yes this is right, there's a builtin Record keyword in the next release you can use like type("Record<string, number>"). It also includes indexed types more generally, so you can equivalently use type({"[string]": "number"}). Until then, you'd need to use a workaround like the one I mentioned.

Did you find this page helpful?