我正在使用Typescript编写React组件。目前我将道具的类型定义为Typescript type。missing in type '{ id: number; }' but required in type 'Props' 在这种情况下,我希望type ParentProps只是type Props的一个数组在实践中,可空名称键适用于Prop类型的各个对象</
假设我在JavaScript中有这些类,我试图将它们转换为TypeScript: tags = { };error TS7022: 'tags' implicitly has type 'any' because it does not have a type annotation这里的错误很明显。我在重新定义this时使用tags,所