From cfeb6bc2df64257bb99da96cf85d91e9b368bca6 Mon Sep 17 00:00:00 2001 From: Trevor Burnham Date: Tue, 2 Sep 2025 08:19:39 -0400 Subject: [PATCH] chore: Update tsconfig target to ES2021 All targeted browsers support ES2021 syntax. This change provides an immediate bundle size reduction, with the potential for further gains if code is rewritten to take advantage of optional chaining and nullish coalescing. * Optional chaining: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#browser_compatibility * Nullish coalescing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing#browser_compatibility --- pages/tsconfig.json | 4 ++-- src/test-utils/tsconfig.json | 4 ++-- tsconfig.json | 10 ++-------- tsconfig.unit.json | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pages/tsconfig.json b/pages/tsconfig.json index 5c14178b3d..f8a9b298a4 100644 --- a/pages/tsconfig.json +++ b/pages/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "lib": ["ES2020", "DOM"], - "target": "ES2015", + "lib": ["ES2021", "DOM"], + "target": "ES2021", "declaration": false, "declarationMap": false, "rootDir": ".", diff --git a/src/test-utils/tsconfig.json b/src/test-utils/tsconfig.json index 568a5797d3..3c7d6e0c4e 100644 --- a/src/test-utils/tsconfig.json +++ b/src/test-utils/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { + "lib": ["ES2021", "DOM"], + "target": "ES2021", "strict": true, "incremental": true, "types": [], "module": "CommonJS", - "target": "ES2015", - "lib": ["ES2020", "DOM"], "declaration": true, "allowSyntheticDefaultImports": true, "outDir": "../../lib/components/test-utils", diff --git a/tsconfig.json b/tsconfig.json index acc514fa68..dc120d7a8a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "lib": ["ES2021", "DOM"], - "target": "ES2015", + "target": "ES2021", "types": [], "module": "ES2015", "moduleResolution": "node", @@ -15,11 +15,5 @@ "incremental": true }, "include": ["src", "types"], - "exclude": [ - "**/__tests__/**", - "src/test-utils/**", - "**/__integ__/**", - "**/__a11y__/**", - "**/__motion__/**" - ] + "exclude": ["**/__tests__/**", "src/test-utils/**", "**/__integ__/**", "**/__a11y__/**", "**/__motion__/**"] } diff --git a/tsconfig.unit.json b/tsconfig.unit.json index 8b2c7d5258..1b2e568fa8 100644 --- a/tsconfig.unit.json +++ b/tsconfig.unit.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "target": "es2018", - "lib": ["es2020", "dom"], + "lib": ["ES2021", "DOM"], + "target": "ES2021", "types": ["node", "jest", "@testing-library/jest-dom"], "moduleResolution": "node", "downlevelIteration": true,