robisim74 / angular-l10n

Angular library to translate texts, dates and numbers
MIT License
380 stars 59 forks source link

Namespace 'Intl' has no exported member 'RelativeTimeFormatOptions' #332

Closed rdasilvaspotzer closed 2 years ago

rdasilvaspotzer commented 2 years ago

Describe the bug After upgrading to v13 I'm having issues compiling with the message Namespace 'Intl' has no exported member 'RelativeTimeFormatOptions'

Error: node_modules/angular-l10n/lib/services/l10n-intl.service.d.ts:39:86 - error TS2694: Namespace 'Intl' has no exported member 'RelativeTimeFormatOptions'.

39     formatRelativeTime(value: any, unit: Intl.RelativeTimeFormatUnit, options?: Intl.RelativeTimeFormatOptions, language?: string): string;

To Reproduce Steps to reproduce the behavior:

  1. On Angular 13 upgrade angular-l10n to 13
  2. ng serve
  3. See error

Desktop (please complete the following information):

Additional context My tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    ...
    "module": "es2020",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2018", "dom"]
  },
  "angularCompilerOptions": {
    "strictTemplates": false
  }
}
robisim74 commented 2 years ago

Your tsconfig seems not updated to Angular v13, you shoud have:

"lib": [
      "es2020",
      "dom"
    ]
rdasilvaspotzer commented 2 years ago

Thank you, that fixed it. To be fair, the update migration to Angular v13 didn't set the lib to es2020 but manually setting it fixed the issue

robisim74 commented 2 years ago

Ok, I updated the release note. Thanks for reporting. Greetings