首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我试图破坏一个对象时,类型记录错误

当我试图破坏一个对象时,类型记录错误
EN

Stack Overflow用户
提问于 2022-08-25 20:36:03
回答 1查看 22关注 0票数 1

我制作了一个具有创建-反应-应用程序类型记录模板的react应用程序。我做了一个简单的卡片组件,我试图破坏一个对象,但是我有以下错误:enter image description here

这是我的tsconfig文件

代码语言:javascript
复制
{
  "compilerOptions": {
    "target":"ES2020",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module":"ES2020",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": [
    "src"
  ],
  "exclude": ["node_modules"]
}

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-08-25 20:41:35

default是开关语句中使用的保留关键字。任何其他名字都行。

代码语言:javascript
复制
interface CardProps {
    default: 'test';
    defaults: 'test';
}

declare const props: CardProps;

const { default } = props; // KO
const { defaults } = props; // OK

See other reserved keywords

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73493450

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档