Skip to content

plugin-grid / plugin-form / plugin-designer / cli / object-ui: remaining type-check debt from the #2911 sweep #2919

Description

@os-zhuang

Tracking issue for the type errors surfaced by the full sweep in #2911 / #2915 that are not covered by #2916 (plugin-view), #2917 (runner) or #2918 (layout). None of these packages had a type-check script, so none of it was visible to CI.

Each package below is listed in DEBT in scripts/check-type-check-coverage.mjs. When one is cleaned, add "type-check": "tsc --noEmit" and delete its DEBT entry — the guard fails if an entry outlives its gap. Reproduce with the paths override its type-checked peers carry (see #2915 for why bare tsc otherwise emits ~104 spurious TS6059 rootDir errors).


@object-ui/plugin-grid — 4 errors

ObjectGrid.tsx:677,678 (TS2345) — real, and trivially fixable:

Argument of type '"Yes"' is not assignable to parameter of type
  '(Record<string, unknown> & ("Yes" | ...)) | undefined'

Two t() calls pass a bare string where i18next's overload wants an options object or a defaultValue — the second argument is being used as a default when it is typed as options.

importParsers.ts:352 (TS2367 x2)runtime is correct; do not "fix" the logic.

let reason: MappingReason = 'none';
const bump = (s: number, r: MappingReason) => { if (s > score) { score = s; reason = r; } };
// ...
if (reason !== 'exact' && reason !== 'normalized' && inferred !== 'text' && score > 0) {

reason is only ever reassigned inside the bump closure, and TypeScript's control-flow analysis does not track mutations through closures — so it still believes reason is narrowed to 'none' at line 352 and reports the comparisons as non-overlapping. At runtime bump genuinely does set 'exact' / 'normalized' / 'synonym', so the type gate works as intended.

The fix is to make the narrowing visible to the checker (e.g. annotate the binding so it is not narrowed to its initialiser, or have bump return the new reason instead of mutating a captured let) — not to change the branch. Deleting the condition because "it is always true" would silently disable the type gate that stops a text column being mapped onto a number field.


@object-ui/plugin-form — 10 errors

6x the same t() fallback-signature mismatch (DrawerForm.tsx:257, ModalForm.tsx:333, SplitForm.tsx:155, TabbedForm.tsx:240, WizardForm.tsx:274):

Type '(objectName: string, fieldName: string, fallback: string) => string' is not
assignable to type '(objectName: string, fieldName: string, fallback?: string | undefined) => string'.

A required third parameter is passed where the contract declares it optional. One shared signature fix should clear all six.

3x string | number | undefined -> string | undefined (DrawerForm.tsx:505, ModalForm.tsx:693, ObjectForm.tsx:182) — a numeric field value reaching a string-only prop; needs a deliberate decision about coercion vs widening the prop.

2x TS2538 (deriveMasterDetail.ts:169) — Type 'undefined' cannot be used as an index type, twice on one line. A genuine missing-guard: worth checking what happens today when the key is absent.


@object-ui/plugin-designer — 1 error

src/components/HistoryPanel.tsx(57,17) TS6133 — 'index' is declared but its value is never read. Note the root tsconfig sets noUnusedLocals: false but noUnusedParameters: true, so this is an unused parameter.


@object-ui/cli — 4 errors

Build is tsup with dts: true, which does not fail on these:

TS2578  Unused '@ts-expect-error' directive.
TS2339  Property does not exist
TS7006  Parameter implicitly has an 'any' type   (x2)

The TS2578 is worth looking at first — an @ts-expect-error that no longer suppresses anything usually means the code underneath it changed behaviour.


object-ui — 1 error

tsconfig.json(12,25): error TS5107: Option 'moduleResolution=node10' is deprecated
  and will stop functioning in TypeScript 7.0.

Config-only, but it is a deprecation with a hard deadlinenode10 resolution stops working in TS 7. The root config already sets "ignoreDeprecations": "6.0"; this package overrides moduleResolution without it. Silencing it is one line, but migrating to bundler/node16 is the actual fix and should be done before TS 7.


@object-ui/site — 7 errors

app/(home)/layout.tsx(4,46): error TS2304: Cannot find name 'LayoutProps'.
app/docs/[[...slug]]/page.tsx(9,43): error TS2304: Cannot find name 'PageProps'.
...   (also RouteContext x2)

These are Next.js generated types from .next/types, which only exist after a next build. Likely a false positive rather than debt: site is excluded from pnpm build (--filter=!@object-ui/site) and its docs build runs in a separate CI job. Decide whether to wire type-check to depend on a build, or to keep site permanently exempt with that reason recorded.

Refs #2911, #2915

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions