Check out this TypeScript code snippet:
export type Mutation = (state: State, data: unknown) => void
export type Mutations = {
[key: string]: Mutation
}
private buildMutations(): Mutations {
return {
['3']: (state, data) => {},
['' + 3]: (state, data) => {},
}
}
In the line ['3']: (state, data) => {}
, state and data have types assigned, but in [''+3]: (state, data) => {}
, they don't. How can I rectify this issue?