TypeScript v5 analysis fails with --lib es2023 (Node.js v18)

Hi!

I am running a SonarQube instance and running the analysis using GitHub Actions (sonarsource/sonarqube-scan-action@master).
But the analysis skips all my source files it detects because it cannot create the TypeScript program:

INFO: Sensor TypeScript analysis [javascript]
INFO: Resolving TSConfig files using 'tsconfig.json' from property sonar.typescript.tsconfigPaths
INFO: Found 1 TSConfig file(s): [/github/workspace/tsconfig.json]
INFO: Creating TypeScript program
INFO: TypeScript configuration file /github/workspace/tsconfig.json
INFO: 14 source files to be analyzed
ERROR: Error: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.  /github/workspace/node_modules/@tsconfig/node18/tsconfig.json:140
ERROR:     at createProgramOptions (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:125:15)
ERROR:     at createProgram (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:151:28)
ERROR:     at default_1 (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/routing/on-create-program.js:10:57)
ERROR:     at Layer.handle [as handle_request] (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at next (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:144:13)
ERROR:     at Route.dispatch (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:114:3)
ERROR:     at Layer.handle [as handle_request] (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at /github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:284:15
ERROR:     at Function.process_params (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:346:12)
ERROR:     at next (/github/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:280:10)
ERROR: Failed to create program: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.  /github/workspace/node_modules/@tsconfig/node18/tsconfig.json:140
INFO: Creating TypeScript program (done) | time=64ms
INFO: Skipped 14 file(s) because they were not part of any tsconfig.json (enable debug logs to see the full list)
INFO: 14/14 source files have been analyzed
INFO: Hit the cache for 0 out of 0
INFO: Miss the cache for 0 out of 0
INFO: Sensor TypeScript analysis [javascript] (done) | time=6430ms

That lib setting comes from bases/node18.json at main · tsconfig/bases · GitHub, which causes the same issue for users not using TypeScript v5 yet: upgrade to @tsconfig/node18@1.0.2 works only with typescript 5 · Issue #173 · tsconfig/bases · GitHub.

The current workaround is using that setting yet and downgrading the @tsconfig/node18 package.
But seeing support for this would be great!

Have a nice weekend ^^


  • SonarQube (Docker): 10.0.0.68432 Community Edition
  • SonarScanner (Executed by official GitHub Actions Action): 4.8.0.2856 (latest release as of writing this)

TypeScript 5 will begin being supported in SonarQube v10.1! It’s not far off (weeks, not months).

1 Like

Thanks for the info! I’ll be waiting that bit then :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.