|
| 1 | +--- |
| 2 | +"@object-ui/plugin-grid": patch |
| 3 | +"@object-ui/plugin-form": patch |
| 4 | +"@object-ui/plugin-designer": patch |
| 5 | +"@object-ui/cli": patch |
| 6 | +"object-ui": patch |
| 7 | +--- |
| 8 | + |
| 9 | +fix(plugin-grid,plugin-form,plugin-designer,cli,vscode-extension): type-check the last five unchecked packages, and fix the two runtime bugs that hid there (#2919) |
| 10 | + |
| 11 | +Closes the remaining `DEBT` entries from the #2911 sweep. Each package gains |
| 12 | +`"type-check": "tsc --noEmit"` and loses its entry in |
| 13 | +`scripts/check-type-check-coverage.mjs`; coverage goes 36 -> 41 of 45 and |
| 14 | +outstanding errors 25 -> 5 (only #2916 `plugin-view` and #2918 `layout` remain). |
| 15 | + |
| 16 | +**Two of these were real bugs, not just type noise.** |
| 17 | + |
| 18 | +`@object-ui/cli` — `objectui validate` could never report a validation failure. |
| 19 | +`ZodError.errors` was removed in Zod 4 (the repo is on 4.4.3), so `.errors` read |
| 20 | +`undefined` and `.forEach` threw a `TypeError` that the enclosing `catch` |
| 21 | +reported as `✗ Error reading or parsing schema file: Cannot read properties of |
| 22 | +undefined` — swallowing the very errors the command exists to print. Now reads |
| 23 | +`.issues`. Verified against the built CLI: an invalid schema now prints |
| 24 | +`1. Invalid input / Code: invalid_union` and exits 1. |
| 25 | + |
| 26 | +`@object-ui/plugin-grid` — grouping a grid by a boolean column showed the raw |
| 27 | +i18n key. `t('grid.booleanTrue', 'Yes')` asked for a key present in neither |
| 28 | +`GRID_DEFAULT_TRANSLATIONS` nor any locale bundle, and passed the English |
| 29 | +fallback as a bare second argument — which `createSafeTranslation`'s no-provider |
| 30 | +translator reads as an *options object*, so the fallback never applied and the |
| 31 | +header rendered the literal `grid.booleanTrue`. Switched to the `grid.yes` / |
| 32 | +`grid.no` keys the boolean cell renderer (`ObjectGrid.tsx`) and |
| 33 | +`BulkActionDialog` already use, with the fallback passed as `defaultValue`. |
| 34 | +Covered by a new regression test, confirmed to fail against the old code. |
| 35 | + |
| 36 | +The rest are type-only corrections that preserve runtime behaviour exactly: |
| 37 | + |
| 38 | +- **plugin-grid** `importParsers.ts` — `scorePair`'s `score`/`reason` moved into |
| 39 | + one `best` record. They were captured `let`s mutated only inside the `bump` |
| 40 | + closure, which TypeScript's control-flow analysis does not track, so it still |
| 41 | + believed `reason` was `'none'` at the type gate and flagged the comparisons as |
| 42 | + non-overlapping (TS2367). The gate — which stops a text column being mapped |
| 43 | + onto a number field — is unchanged; its two dedicated tests still pass. |
| 44 | +- **plugin-form** — `SectionFieldsContext.fieldLabel` now requires `fallback`, |
| 45 | + matching the `useSafeFieldLabel` producer in `@object-ui/i18n` (an omitted |
| 46 | + fallback could not satisfy the `=> string` return, and all four call sites |
| 47 | + already pass one). This one signature cleared six errors. |
| 48 | + `MasterDetailFormSchema.recordId` widens to `string | number`, matching |
| 49 | + `ObjectFormSchema` and the five envelopes that forward straight into it; |
| 50 | + it is narrowed with `String()` only at the batch-transaction boundary, whose |
| 51 | + `BatchTransactionOperation.id` is a string by protocol (the `isEdit` guard |
| 52 | + already proves it non-null there). `deriveMasterDetail`'s column sort gets an |
| 53 | + explicit `fillPriority` helper — `GridColumn.type` is optional, and a column |
| 54 | + without one keeps sorting at priority 5 exactly as the old |
| 55 | + `TYPE_FILL_PRIORITY[undefined] ?? 5` lookup put it. |
| 56 | +- **plugin-designer** — unused `index` parameter prefixed `_`, matching the |
| 57 | + `_entry` beside it. |
| 58 | +- **cli** — a stale `@ts-expect-error` removed; `viteConfig` is typed `any`, so |
| 59 | + the line it guarded had stopped erroring. |
| 60 | +- **vscode-extension** (`object-ui`) — migrated off `moduleResolution: "node"`, |
| 61 | + which is deprecated and stops working in TypeScript 7, to `node16` paired with |
| 62 | + `module: "node16"` (the package has no `"type": "module"`, so node16 resolves |
| 63 | + it as the CommonJS that tsup emits, and it gains the `exports`-map awareness |
| 64 | + node10 lacks). Its error count was under-reported as 1: that TS5107 config |
| 65 | + error masked four more. The package uses `console`/`Buffer` but sets |
| 66 | + `lib: ["ES2020"]` with no DOM and never declared `@types/node` — added, with an |
| 67 | + explicit `types: ["node", "vscode"]`. |
| 68 | + |
| 69 | +Also: `plugin-grid`, `plugin-form` and `plugin-designer` gain the `baseUrl` + |
| 70 | +`paths` override their type-checked plugin peers already carry, and `cli` an |
| 71 | +empty `paths`. Without it the inherited root `paths` point `@object-ui/*` at |
| 72 | +sibling `src/`, which is outside each project's `rootDir` and produces the ~104 |
| 73 | +spurious TS6059 errors noted in #2915; workspace deps instead resolve through |
| 74 | +node_modules to built `.d.ts`, which `type-check`'s `dependsOn: ["^build"]` |
| 75 | +guarantees exist. |
| 76 | + |
| 77 | +Verified the gate genuinely covers all five rather than trusting the green: |
| 78 | +injecting a type error into each package makes `pnpm type-check --filter <pkg>` |
| 79 | +fail, which was impossible before this change. |
0 commit comments