You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to get the keys of an array of fixed length, without adding as const to the end of the array. I'm able to get the strict values of it, but not the keys.
Describe the solution you'd like
I'd like to use a type factory to get the readonly keys of an array:
import{List}from"ts-toolbelt";functionmakeTheme<T>(t: T): T{returnt;}// comment in the 'as const' to solve it 馃槙consttheme=makeTheme({space: [1,2]// as const});typeSpace=List.CompulsoryKeys<typeoftheme["space"]>;// this should workconstspace: Space="0";// this should only allow "0" and "1", but it allows any numberconstkey: keyoftypeoftheme["space"]=10;
馃崺 Feature Request
I want to get the keys of an array of fixed length, without adding
as const
to the end of the array. I'm able to get the strict values of it, but not the keys.Describe the solution you'd like
I'd like to use a type factory to get the readonly keys of an array:
Describe alternatives you've considered
Code: https://codesandbox.io/s/ts-toolbelt-test-forked-89wql?file=/src/index.ts:0-396
Screenshots
Thank you!!
The text was updated successfully, but these errors were encountered: