Namespace 'Intl' has no exported member 'LocalesArgument'

Viewed 42

Using React and TypeScript I'm trying to type a function that passes arguments to Date.toLocaleString but when I try to use Intl.LocalesArgument I get an error saying Namespace 'Intl' has no exported member 'LocalesArgument'. My tsconfig.json is below and I have tried changing target to es2020 and restarting the dev server to no avail.

{
  "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"
  ]
}
1 Answers

I was on TypeScript 4.6.3, upgrading to the latest version (4.8.2 at the time of writing) fixed this issue.

Related