Skip to content

finding(plugin-calendar): ObjectCalendarComponentProps.schema is typed ObjectGridSchema | CalendarSchema, so no object-calendar node is assignable — the documented direct-React usage cannot compile #7311

Description

@yinlianghui

Found while bringing content/docs/plugins/plugin-calendar.mdx under check:doc-snippet-types (objectui#5174 batch 6, PR to follow). Filed unassigned and not fixed there — that PR's surface is the UNGATED_DOCS ledger plus three doc pages, and packages/* source is out of scope by its dispatch.

What

packages/plugin-calendar/src/ObjectCalendar.tsx declares:

schema: ObjectGridSchema | CalendarSchema;

Neither member admits an object-calendar node:

  • ObjectGridSchema.type is the literal 'object-grid' (packages/types/dist/objectql.d.ts).
  • CalendarSchema is the form date pickertype: 'calendar', with mode, minDate, maxDate, onChange (packages/types/dist/form.d.ts). It is a different widget entirely.

ObjectCalendarSchematype: 'object-calendar', objectName, startDateField, endDateField, titleField, defaultView — exists in @object-ui/types and is exported, but this prop does not name it.

Measured

Compiled against the built dist, --strict, through the doc-snippet gate's own program:

[semantic] content/docs/plugins/plugin-calendar.mdx TS2322:
  Type '{ objectName: string; calendar: { startDateField: string; titleField: string; }; }'
  is not assignable to type 'ObjectGridSchema | CalendarSchema'.
  Property 'type' is missing in type '{ ... }' but required in type 'ObjectGridSchema'.

Adding the type the page teaches does not clear it — it moves the diagnostic to
Type '"object-calendar"' is not assignable to type '"object-grid"', because that member is a single literal.

Why this is the declaration's half, not the documentation's

The runtime path is real and is the one the platform itself takes:

  • packages/plugin-calendar/src/index.tsx registers ObjectCalendarRenderer for object-calendar (and for view:calendar) and renders ObjectCalendar with schema={bound} — the authored object-calendar node. The renderer is typed schema: any, so nothing turns the node away at that boundary.
  • ObjectCalendar.tsx reads objectName (line 120), staticData (113), data (109), filter and sort — and reaches the calendar block through (schema as any).calendar in getCalendarConfig (line 140).

So the component genuinely serves object-calendar nodes and its own reads are spelled as any to get at them. That is the same shape twice ruled on already:

  • objectui#5018 — ObjectMapSchema: "组件 props 类型写的是 ObjectGridSchema,每处 map 读取都走 as any" (closed).
  • objectui#5903 — ObjectGanttProps.schema moved from ObjectGridSchema to ObjectGanttSchema, and its docblock records the same reason: "It used to be ObjectGridSchema, and that is why ten genuine reads had to be spelled (schema as any).K".

plugin-calendar is the remaining member of that family.

Cost

A reader following the page's Direct Component Usage section — importing ObjectCalendar and rendering it in their own React tree, which is exactly what that section is for — cannot type-check the schema they were just taught to write. The two escapes are both bad: annotate as ObjectGridSchema (what the page's TypeScript Support section did until this batch corrected it — an annotation that is simply false), or cast, which is the lenient-consumer workaround AGENTS.md refuses.

Because of this, that block ships in the batch-6 PR carrying a FRAGMENT_MARKER declaration naming this gap, rather than a cast. It becomes a compiling block the day the declaration names ObjectCalendarSchema.

Scope note, unmeasured here

Whether ObjectCalendarSchema should also declare calendar (it does not today, so the block lands on BaseSchema's index signature and is unchecked) is a second, related question — ObjectGanttSchema does declare gantt. Recorded, not asserted: that is a separate decision about the authoring surface, not part of repointing this prop.

Related: objectui#5018, objectui#5903, objectui#5784, objectui#5667.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:queuepriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions