未定义打字稿“记录”
我正在使用 TypeScript 编写 React-Native 项目,到目前为止一切正常,但以下部分引发错误:
export interface Country {
name: string;
cities: Record<string, string>;
}
错误是:
3:13 error 'Record' is not defined no-undef
我的打字稿使用工作区版本而不是 VS Code 的版本。另外,当我 cmd+click 时Record,我可以转到它的定义,它在文件中lib.es5.d.ts:
type Record<K extends keyof any, T> = {
[P in K]: T;
};
所以,Record显然是在node_modules下定义并找到的,但是当我运行linter(@typescript-eslint)时,我无法修复这个错误
我的内容.vscode/settings.json如下所示:
"typescript.tsdk": "node_modules/typescript/lib"
我还没有找到任何解决方案,你能帮忙吗?
打字稿版本:“4.1.4”,