tsconfig / bases

Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment
MIT License
6.12k stars 231 forks source link

bug: argument for lib option invalid for TS 4.9 and below on node18 #174

Open prescottprue opened 1 year ago

prescottprue commented 1 year ago

I'm seeing the following error with the 2.0.0 release when using with tsc and ts-node:

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'.

It appears to be due to the change here where lib was updated to es2023 - was it meant to be the target field?

philihp commented 1 year ago

yeah, broken over here too. Maybe that works for node 20, but it doesn't work for 18

orta commented 1 year ago

I assume you're talking about the node18 tsconfig base: 2.0 supports TypeScript 5.0+, use 1.x for older versions of typescript

prescottprue commented 1 year ago

@orta That is totally fair and I confirmed on my end - things build after being on Typescript 5. Is there a way that we can document that in the release notes or README or both?

Is there a way that we can mark typescript 5 as a required peer dependency so that others don't bump into this and need to look for docs?

fasani-tx commented 1 year ago

Same issue here, bumping to TS5 worked.

orta commented 1 year ago

After npm7 I don't trust peer dependencies with that dependency manager, you don't want to accidentally have two copies of typescript in your deps. I'm open to a table at the bottom of the README showing what are the latest versions for TS 4.9 and below

kevinlul commented 1 year ago

I ran into this issue as well:

TSError: ⨯ Unable to compile TypeScript:
../../../node_modules/@tsconfig/node16/tsconfig.json:7:15 - error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'.

7     "module": "Node16",