Ali*_*idi 13 javascript typescript reactjs next.js
我想toReversed()
在 TypeScript 上使用 ES2023 方法,但在构建 Next.js 项目时遇到此错误:
类型错误:类型“Job[]”上不存在属性“toReversed”。您指的是 'reverse' 吗?
我尝试将 TypeScript 更新到最新版本并添加"ES2023"
和"ES2023.Array"
进去lib
,tsconfig.json
但它不起作用。
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext", "ES2023", "ES2023.Array"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "components/Home/about.tsx", "components/Socials/Icons/socialIcons.tsx", "components/Socials/socials.tsx", "pages/_app.tsx", "functions/formatDate.ts"],
"exclude": ["node_modules"]
}
Run Code Online (Sandbox Code Playgroud)
我已经看到了This Question,但他没有将"ES2023"
和添加"ES2023.Array"
到他的tsconfig.json
文件中,而且我不知道为什么即使我更新了tsconfig.json
文件,我仍然收到此错误。
为什么我的tsconfig.json
文件中的 ES2023 配置不断出现此错误?
由于 Typescript 5.2 现在可用,因此 tsconfig.json 的“lib”属性中包含“ES2023”或“ES2023.Array”现在应该可以工作。
归档时间: |
|
查看次数: |
5509 次 |
最近记录: |