Skip to content

Commit

Permalink
tsconfig: Use ESNext in target and lib
Browse files Browse the repository at this point in the history
From what I can tell, the value of target doesn't actually matter,
because we have noEmit set to true - its esbuild in dev (configured
by Vite's esbuild.target) and Rollup for prod build (configured by
build.target) that do the transpiling, but there's no harm in
updating it anyway.

Setting "lib" to include ESNext allows us to use more modern features
such as "promise.any, string.replaceAll etc" (ES2021) and
"array.at, RegExp.hasIndices, etc." (ES2022).

Its also worth noting that these are the values of the tsconfig.json
that come when using Laravel Breeze with one of its TS starters.

See:
* https://www.typescriptlang.org/tsconfig#lib
* https://www.typescriptlang.org/tsconfig#target
* https://github.com/laravel/breeze/blob/095c4c597c3719e2a596fcf4689288e9cdbc6520/stubs/inertia-react-ts/tsconfig.json
  • Loading branch information
philbates35 committed Feb 15, 2024
1 parent abde0b3 commit 299321c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
Expand Down

0 comments on commit 299321c

Please sign in to comment.