首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >名称空间'Intl‘没有导出成员'LocalesArgument’

名称空间'Intl‘没有导出成员'LocalesArgument’
EN

Stack Overflow用户
提问于 2022-09-07 14:45:17
回答 1查看 269关注 0票数 0

使用React和TypeScript,我试图键入一个将参数传递给Date.toLocaleString的函数,但是当我尝试使用Intl.LocalesArgument时,会出现一个错误,即Namespace 'Intl' has no exported member 'LocalesArgument'。我的tsconfig.json在下面,我尝试将target更改为es2020并重新启动dev服务器,但没有结果。

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

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-07 19:02:59

我在TypeScript 4.6.3上,升级到最新版本(撰写本文时的4.8.2)修复了这个问题。

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

https://stackoverflow.com/questions/73637484

复制
相关文章

相似问题

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