Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

246
Visualizações
Angular app: es2020 migration from es2015

I have just updated my app to Angular 12 and am trying to use es2020. For some reason I am still getting errors when my app builds because it seems the app is still trying to use es2015:

node_modules/typescript/lib/lib.es2015.promise.d.ts:33:34
[ng]     33     new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
[ng]                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
[ng]     An argument for 'value' was not provided.

I've updated tsconfig.json to reflect es2020:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "inlineSources": true,
    "declaration": false,
    "sourceRoot": "/",
    "module": "es2020",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2020",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2020",
      "dom"
    ]
  },
  "exclude": [
    "node_modules",
    "**.*.spec.ts",
    "plugins/**"
  ]
}

EDIT:

When I serve my app I also see the following:

[ng] Compiling @angular/core : es2015 as esm2015
[ng] Compiling @ionic-native/core : module as esm5
[ng] Compiling @angular/common : es2015 as esm2015
[ng] Compiling @angular/cdk/collections : es2015 as esm2015
[ng] Compiling @ionic-native/splash-screen : module as esm5
[ng] Compiling @ionic-native/barcode-scanner : module as esm5
[ng] Compiling @ionic-native/status-bar : module as esm5
[ng] Compiling @angular/platform-browser : es2015 as esm2015
[ng] Compiling @angular/cdk/platform : es2015 as esm2015

Lastly, I am already using Typescript 4.3.5 in my package.json.

But I have not explicitly installed any new typings since making the change. What do I do next to allow the change to es2020?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Remember when you target ES2020 you exclude any users with iOS 13.3 and below (most likely if you're using ?? or ?.). While that version is 2+ years old it's important to check your server logs to see how many users / customers are still using (and maybe bringing revenue) with old browsers.

Unfortunately since Safari is tied to the iOS version if someone doesn't update iOS they fall behind with Safari and ES versions too.

The point is to make sure you really want to do this before doing it.

Personally I created ts.config.ES2020.app and ts.config.ES2015.app files for both and I use configuration profiles in angular.json to choose 2020 during development.

That means I'll see modern things like ?? in my development browser but that $85 we got from Safari 13.3 users the first half of this year will hopefully double!

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda