Я пытаюсь запустить реагирующий материал в проекте Typescript.
Так как я новичок в Typescript, у меня есть некоторые ошибки, я не знаю, как их решить.
В этом guest Я пытаюсь создать повторно используемый компонент React. (Пожалуйста, откройте гость, чтобы увидеть полный код)
Как я уже сказал, в приведенном выше примере показаны некоторые ошибки, это пример в строке 48 в homePage:
No overload matches this call.
Overload 1 of 2, '(props: Readonly<MaterialTableProps<IData>>): KTable<IData>', gave the following error.
Type '{ title: string; field: string; type: string; }[]' is not assignable to type 'Column<IData>[]'.
Type '{ title: string; field: string; type: string; }' is not assignable to type 'Column<IData>'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type '"string" | "boolean" | "time" | "numeric" | "date" | "datetime" | "currency" | undefined'.
Overload 2 of 2, '(props: MaterialTableProps<IData>, context?: any): KTable<IData>', gave the following error.
Type '{ title: string; field: string; type: string; }[]' is not assignable to type 'Column<IData>[]'.ts(2769)
Почему этот массивпоказывает ошибку?
columns = [...{
title: "Birth Place",
field: "birthCity",
type: "string" // ERROR ?!
}]
Несмотря на то, что интерфейс четко определяет, что тип принимает строку:
type?: ('string' | 'boolean' | 'numeric' | 'date' | 'datetime' | 'time' | 'currency');
Было бы полезно, если у кого-то есть идея, как получить эту работу.