TypeScript general type error won't work ? Generic type 'propsType' requires 1 type argument (s).
CodePudding user response:
You are not initializing expenses
properly (1 type argument is missing apparently). Therefore expenses
is not of type propsType
, so Typescript falls back to any
type. When you do .map()
on a variable that is of type any
, then the values inside that map will also be of type any
.
CodePudding user response:
You must pass a type as T on definition of "expenses" for example:
export const expenses: propsType<number>....