docs: add the missing cast to .input() in the Task 3 plan snippet
The builder's .input() did not typecheck as written (TS2345). The phantom __input/__output markers make ProcedureDef invariant, which is exactly why .output<T>() already carried a cast - .input() needed the analogous one and did not have it. Caught by the Task 3 implementer, who also verified via @ts-expect-error that InferProcedureInput/InferProcedureOutput genuinely reject wrong shapes, so the phantom markers are carrying real type information rather than silently widening. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -561,7 +561,14 @@ export class ProcedureBuilder<Input, Output> {
|
||||
}
|
||||
|
||||
input<S extends ObjectSchema<object>>(schema: S): ProcedureBuilder<InferInput<S>, Output> {
|
||||
return new ProcedureBuilder<InferInput<S>, Output>({ ...this.def, input: schema });
|
||||
// The cast is required for the same reason .output<T>() needs one: the
|
||||
// phantom __input/__output markers make ProcedureDef invariant, so
|
||||
// spreading a ProcedureDef<Input, Output> into a ProcedureDef<InferInput<S>,
|
||||
// Output> is not assignable without it. No runtime effect.
|
||||
return new ProcedureBuilder<InferInput<S>, Output>({
|
||||
...this.def,
|
||||
input: schema,
|
||||
} as ProcedureDef<InferInput<S>, Output>);
|
||||
}
|
||||
|
||||
output<T>(): ProcedureBuilder<Input, T> {
|
||||
|
||||
Reference in New Issue
Block a user