From 1e70c09961d0e1acbaa6165fe677f5d88d5c0171 Mon Sep 17 00:00:00 2001 From: Will Eastcott Date: Wed, 27 May 2026 20:18:46 +0100 Subject: [PATCH] chore: prepare for TypeScript 6.x Update tsconfig.json and react/tsconfig.json to use `moduleResolution: "bundler"` (matches how Rollup actually resolves modules and understands the `exports` field) and add an explicit `strict: false` so intent is unambiguous regardless of future default changes. Convert all 38 `@ts-ignore` directives to `@ts-expect-error` across 20 files. `@ts-expect-error` requires the line below it to actually produce a type error, so if a future TS release fixes any of the underlying typing issues the build fails loudly with "unused directive" instead of the suppression silently going dead. All six checks (build:es6, build:react:es6, build:types, test, lint, publint) pass on TS 5.9.3 with these changes applied. Co-Authored-By: Claude Opus 4.7 (1M context) --- react/tsconfig.json | 3 ++- src/binding/BindingBase/index.ts | 4 ++-- src/components/ArrayInput/index.ts | 2 +- src/components/Button/component.tsx | 2 +- src/components/Canvas/component.tsx | 2 +- src/components/ColorPicker/component.tsx | 2 +- src/components/ColorPicker/index.ts | 4 ++-- src/components/Container/component.tsx | 2 +- src/components/Container/index.ts | 2 +- src/components/Element/component.tsx | 10 +++++----- src/components/Element/index.ts | 10 +++++----- src/components/GradientPicker/component.tsx | 2 +- src/components/GradientPicker/index.ts | 4 ++-- src/components/GridViewItem/index.ts | 2 +- src/components/InfoBox/component.tsx | 2 +- src/components/Label/component.tsx | 2 +- src/components/Menu/index.ts | 4 ++-- src/components/Panel/index.ts | 12 ++++++------ src/components/SelectInput/index.ts | 4 ++-- src/components/Spinner/component.tsx | 2 +- src/components/TreeView/index.ts | 2 +- tsconfig.json | 3 ++- 22 files changed, 42 insertions(+), 40 deletions(-) diff --git a/react/tsconfig.json b/react/tsconfig.json index 5c06d1f9..c7a368a7 100644 --- a/react/tsconfig.json +++ b/react/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "strict": false, "noImplicitAny": true, "allowJs": true, "target": "es2020", @@ -13,7 +14,7 @@ ], "esModuleInterop": true, "sourceMap": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "skipLibCheck": true, "resolveJsonModule": true, "forceConsistentCasingInFileNames": true, diff --git a/src/binding/BindingBase/index.ts b/src/binding/BindingBase/index.ts index 05a7cd6d..4959706b 100644 --- a/src/binding/BindingBase/index.ts +++ b/src/binding/BindingBase/index.ts @@ -264,7 +264,7 @@ class BindingBase extends Events { */ set historyEnabled(value) { if (this._history) { - // @ts-ignore + // @ts-expect-error this._history.enabled = value; } } @@ -273,7 +273,7 @@ class BindingBase extends Events { * Gets whether history is enabled for the binding. */ get historyEnabled() { - // @ts-ignore + // @ts-expect-error return this._history && this._history.enabled; } diff --git a/src/components/ArrayInput/index.ts b/src/components/ArrayInput/index.ts index b719eeba..a1c2dc63 100644 --- a/src/components/ArrayInput/index.ts +++ b/src/components/ArrayInput/index.ts @@ -179,7 +179,7 @@ class ArrayInput extends Element implements IFocusable, IBindable { this._getDefaultFn = args.getDefaultFn ?? null; - // @ts-ignore + // @ts-expect-error let valueType = args.elementArgs && args.elementArgs.type || args.type; if (!ArrayInput.DEFAULTS.hasOwnProperty(valueType)) { valueType = 'string'; diff --git a/src/components/Button/component.tsx b/src/components/Button/component.tsx index 61703966..8f44c052 100644 --- a/src/components/Button/component.tsx +++ b/src/components/Button/component.tsx @@ -11,7 +11,7 @@ class Button extends Element { static ctor = ButtonClass; render() { - // @ts-ignore + // @ts-expect-error return