You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mongo TS field.temporal.timestamp(undefined, 'now') types both phases as optional #30466
What a user sees. In the Mongo TypeScript builder, field.temporal.timestamp() and field.temporal.timestamp('now', 'now') get exact types. field.temporal.timestamp(undefined, 'now') does not: TypeScript widens both option arguments to "the option or undefined", so the field's type says both onCreate and onUpdate are optional. The onUpdate default the user asked for is typed as maybe absent, and the create and update input types are less precise than for the other two forms.
Where. The phase-template typing in packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts (the doc comment above the phase template describes the widening); pinned as current behaviour in packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.execution-defaults.test-d.ts.
Likely fix. Give the TypeScript form named-object arguments, field.temporal.timestamp({ onUpdate: 'now' }), which TypeScript infers exactly, and check what the SQL TypeScript temporal.timestamp signature does so both families take the same shape.
Activity