score:1

Accepted answer

You have to implicitly tell TypeScript that this is the array of the keys of the state.

const SomeFields: Array<keyof State>

This is also improving TS experience as you will get code completion in your editor/IDE when trying to e.g. add an element to SomeFields or use switch etc.


Related Query

More Query from same tag