sinclairzx81 / typebox

Json Schema Type Builder with Static Type Resolution for TypeScript
Other
4.65k stars 150 forks source link

Revision 0.32.22 #840

Closed sinclairzx81 closed 3 months ago

sinclairzx81 commented 3 months ago

This PR adds support for optional and readonly Function and Constructor arguments. This PR only updates inference for these types.

const T = Type.Function([
  Type.Number(),
  Type.Optional(Type.Number())
], Type.Number())

type T = Static<typeof T>

// type T = (param_0: number, param_1?: number) => number