From 753d28a38b114226b2386b48c9ebdd039b7bf808 Mon Sep 17 00:00:00 2001 From: woksin Date: Fri, 10 Jul 2026 08:09:23 +0200 Subject: [PATCH] Upgrade TypeScript to 7.0.2 Update Samples to TypeScript 7 (the native compiler) for improved build/typecheck performance. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../plugin-disable-typescript-compat.cjs | 31 +++++++++++++++++++ .yarnrc.yml | 4 +++ Library/Lending/.frontend/tsconfig.json | 13 ++++---- Library/Members/.frontend/tsconfig.json | 3 +- package.json | 2 +- tsconfig.json | 1 - 6 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 .yarn/plugins/plugin-disable-typescript-compat.cjs diff --git a/.yarn/plugins/plugin-disable-typescript-compat.cjs b/.yarn/plugins/plugin-disable-typescript-compat.cjs new file mode 100644 index 00000000..2ad155f8 --- /dev/null +++ b/.yarn/plugins/plugin-disable-typescript-compat.cjs @@ -0,0 +1,31 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { + name: `plugin-disable-typescript-compat`, + factory: function (require) { + const { structUtils } = require(`@yarnpkg/core`); + return { + hooks: { + // Yarn's builtin `compat/typescript` patch rewrites the `typescript` + // dependency to patch lib/_tsc.js, lib/tsserver.js, lib/typescript.js. + // The TypeScript 7 native compiler ships only lib/tsc.js + bin/tsc, so + // that builtin patch fails with ENOENT. This hook runs after the compat + // plugin and unwraps the builtin patch back to the plain npm descriptor. + reduceDependency: function (dependency) { + if ( + dependency.name === `typescript` && + dependency.range.startsWith(`patch:`) && + dependency.range.includes(`builtin`) + ) { + const source = decodeURIComponent( + structUtils.parseRange(dependency.range).source + ); + const original = structUtils.parseDescriptor(source, true); + return structUtils.makeDescriptor(dependency, original.range); + } + return dependency; + }, + }, + }; + }, +}; diff --git a/.yarnrc.yml b/.yarnrc.yml index 0ac7d7f3..d6f06232 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -7,6 +7,10 @@ packageExtensions: dependencies: supports-color: "*" +plugins: + - path: .yarn/plugins/plugin-disable-typescript-compat.cjs + spec: "plugin-disable-typescript-compat" + pnpMode: loose compressionLevel: mixed diff --git a/Library/Lending/.frontend/tsconfig.json b/Library/Lending/.frontend/tsconfig.json index 319298a5..a4ad5b62 100644 --- a/Library/Lending/.frontend/tsconfig.json +++ b/Library/Lending/.frontend/tsconfig.json @@ -2,25 +2,24 @@ "extends": "../../../.frontend/tsconfig.base.json", "compilerOptions": { "allowImportingTsExtensions": true, - "baseUrl": "..", "paths": { "Components/*": [ - "Components/*" + "../Components/*" ], "Components": [ - "Components/index" + "../Components/index" ], "Layout/*": [ - "Layout/*" + "../Layout/*" ], "Authors/*": [ - "Authors/*" + "../Authors/*" ], "Inventory/*": [ - "Inventory/*" + "../Inventory/*" ], "Lending/*": [ - "Lending/*" + "../Lending/*" ] } }, diff --git a/Library/Members/.frontend/tsconfig.json b/Library/Members/.frontend/tsconfig.json index 20f74b78..6c627837 100644 --- a/Library/Members/.frontend/tsconfig.json +++ b/Library/Members/.frontend/tsconfig.json @@ -2,10 +2,9 @@ "extends": "../../../.frontend/tsconfig.base.json", "compilerOptions": { "allowImportingTsExtensions": true, - "baseUrl": "..", "paths": { "Profiles/*": [ - "Profiles/*" + "../Profiles/*" ] } }, diff --git a/package.json b/package.json index dc4a9fe3..89bfe842 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "sinon-chai": "4.0.1", "tailwindcss": "4.3.1", "ts-node": "10.9.2", - "typescript": "6.0.3", + "typescript": "7.0.2", "typescript-eslint": "8.62.0", "vite": "8.1.0", "vite-plugin-commonjs": "0.10.4", diff --git a/tsconfig.json b/tsconfig.json index 310e8bbd..c4416be9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "dist/esm", "declaration": true, "declarationMap": true,