Skip to content

@objectstack/spec root entry: two MORE structurally-mentioned types are unnameable through the CHUNKED build (BaseValidationRuleShape, FilterCondition) — a minimal defineStack consumer still hits TS2883 #11709

Description

@os-warren

Measured while implementing #11350 (whose ruling scoped the repair to the three names measured there: FormFieldInput, NavigationItemInput, StateNodeConfig — this delta is deliberately NOT fixed in that PR, per the dispatch's instruction to report rather than silently widen a ruled surface change).

Measurement (worktree at 4ceae8ab0 + the #11350 re-exports, freshly built spec dist)

A minimal one-file program — the smallest consumer shape there is:

import{defineStack}from'@objectstack/spec';exportdefaultdefineStack({objects: []});

compiled with declaration: true + noEmit, module/moduleResolution NodeNext, resolving @objectstack/spec through a real node_modules symlink (the same physical resolution a pnpm workspace consumer performs), produces — through the ordinary CHUNKED build — two TS2883 errors beyond the three #11350 repaired:

consumer.ts(3,1): error TS2883: The inferred type of 'default' cannot be named without a reference to 'BaseValidationRuleShape' from './node_modules/@objectstack/spec/dist/object.zod-OA2khMnR'. This is likely not portable. A type annotation is necessary.
consumer.ts(3,1): error TS2883: The inferred type of 'default' cannot be named without a reference to 'FilterCondition' from './node_modules/@objectstack/spec/dist/filter.zod-DVwOdic1'. This is likely not portable. A type annotation is necessary.

Both names are already public on @objectstack/spec/data (api-surface/data.json records BaseValidationRuleShape (interface), FilterCondition (type), FilterConditionSchema (const)).

Why #11350's measurements did not surface these two

So the class the #11350 ruling's invariant names — a type that appears structurally in an entry's public declarations must be nameable from that same entry — is still open at the root entry: any consumer whose program does not otherwise import @objectstack/spec/data and lets tsc infer through a root-entry function hits it. The trigger population is real (an objectstack.config.ts that defines only, say, apps/flows and no objects imports nothing from /data).

Repro harness

packages/spec/scripts/root-entry-type-nameability.pin.test.ts (landed with #11350's PR) is the exact harness: drop its context.ts fixture from the consumer program and the pin goes red with precisely the two errors above. Its docblock records this delta and points here.

Options

Recommendation: A′ now (the surface promise is already made one subpath away, and the pull is the same class the maintainer already accepted), C as the follow-up that ends the per-name whack-a-mole.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions