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
I have noticed that the t.optional is equivalent to T|undefined|null which may be a quite different behaviour from T|undefined and T, in particular with the new typescript 4.4 --exactOptionalPropertyTypes
Would be possible to add to more optionals to the library? In the specific:
optionalNonNull for undefined properties, compliant with typescript without--exactOptionalPropertyTypes
// Type definitionexportdeclareconstoptionalNonNull: <RTextendst.Mixed>(rt: RT,name?: string|undefined)=>t.UnionC<[RT,t.UndefinedC]>&Optional;// ImplementationexportconstoptionalNonNull=<RTextendst.Mixed>(rt: RT,name?: string)=>{constunionType=union([rt,undefinedType],name||rt.name+'?');returnObject.assign(unionType,{optional: true}asOptional);};
optionalExact for exact properties, compliant with typescript with--exactOptionalPropertyTypes
// Type definitionexportdeclareconstoptionalExact: <RTextendst.Mixed>(rt: RT)=>RT&Optional;// ImplementationexportconstoptionalExact=<RTextendst.Mixed>(rt: RT)=>{returnObject.assign(rt,{optional: true}asOptional);};
The text was updated successfully, but these errors were encountered:
I have noticed that the
t.optional
is equivalent toT|undefined|null
which may be a quite different behaviour fromT|undefined
andT
, in particular with the new typescript 4.4--exactOptionalPropertyTypes
Would be possible to add to more optionals to the library? In the specific:
optionalNonNull for undefined properties, compliant with typescript without
--exactOptionalPropertyTypes
optionalExact for exact properties, compliant with typescript with
--exactOptionalPropertyTypes
The text was updated successfully, but these errors were encountered: