Skip to content

8 packages' scripts/i18n-extract.config.ts fail to type-check: TS2883 on an inferred default naming @objectstack/spec's hashed dist chunks #10868

Description

@os-zhuang

Surfaced by the #10756 census (the source-coverage blind spot), not repaired there: that
card's surface is scripts/check-type-check-coverage.mjs plus the ledger seed, and this
is eight packages' worth of real type errors that need a type annotation each.

The measurement

Each of these directories is in UNCHECKED_SOURCE_DEBT because no tsc program its
package's typecheck script runs reads it. Compiled directly (package's own config,
rootDir neutralised, dependency closure built, on main @ 5886ee6d22):

directoryerrors
packages/platform-objects/scripts1
packages/plugins/plugin-approvals/scripts3
packages/plugins/plugin-audit/scripts3
packages/plugins/plugin-security/scripts3
packages/plugins/plugin-sharing/scripts3
packages/plugins/plugin-webhooks/scripts3
packages/services/service-messaging/scripts3
packages/services/service-realtime/scripts3

Every one is the same shape, e.g.

packages/plugins/plugin-audit/scripts/i18n-extract.config.ts(24,1): error TS2883: The
inferred type of 'default' cannot be named without a reference to
'../node_modules/@objectstack/spec/dist/view.zod-Vrw2Wzfj.js'. This is likely not
portable. A type annotation is necessary.

with the three referenced symbols being FormFieldInput (view.zod-<hash>),
NavigationItemInput (app.zod-<hash>) and StateNodeConfig
(state-machine.zod-<hash>). platform-objects hits only the StateNodeConfig one.

Why it is worth a card

Two independent things are wrong and either could be the right repair:

  1. The config files export an un-annotated default. The immediate fix is a type
    annotation on each export, which is what the diagnostic asks for.
  2. @objectstack/spec leaks hash-named internal chunks into inferred types. The
    names in the diagnostic (view.zod-Vrw2Wzfj.js) are build artefacts whose hashes
    change on rebuild, so any consumer inferring a type through them is non-portable by
    construction. Note the extension differs across packages (.js for some, .mjs for
    others), which is the chunk map, not the consumer.

Repair (2) and (1) may become unnecessary; repair (1) alone leaves the next consumer to
rediscover (2). Worth deciding rather than patching eight files.

Related: #4736 (closed) touched all nine of these configs for a different reason and
records that there are nine repo-wide — the ninth,
packages/services/service-storage/scripts, is not in the table because that package
does not currently reach the census's "covered" scope.

Dedupe

search_issues for the TS2883 wording, i18n-extract, and the spec-dist-chunk shape
returns only closed cards (#4736, #4963, #4570), none of which names this.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions