I am having two files,
App.tsx:
const data = {games:{type: [], sport: [], category: []}}
The above is the dynamic data I receive .
I am in the need to set the above keyof typeof data.games to the type valid like,
type Valid = keyof typeof data.games
If it is same file then no issues to assign like the above.
But I have type file separately like,
Apptype.ts
// How can I make the below keyof typeof [dynamicName] ?
export type Valid = keyof typeof data.games;
export interface IOption {
id: number;
value: string;
valid: Record<Valid, number[]>;
}
In the above file data.games throw error because there will not be such variable name in this file.
So how can I assign the dynamic value to keyof typeof [.....]?
Working Example:
datafrom where it's defined or defineValidin the same module and export that