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've noticed that when using TypeScript in our project, the IDE doesn't suggest props when utilizing the Pick or Omit methods. I have a feeling that this functionality used to be available before.
Any insights on why this feature is no longer working or if I may be mistaken about its previous availability
The text was updated successfully, but these errors were encountered:
TypeBox previously inferred Pick/Omit and Index property keys, however it was removed on 0.32.x as the inference required to obtain the keys was proving very expensive (as TB needed to either Static or derive keys during composition (which was a problem for very deeply nested / computed types)), also the exact property key values resulted in a few issues when using Pick/Omit/Index in generic functions (where keys are passed as generic arguments)
As of 0.32.0, TypeBox allows passing any keys, however you should check the return value of Omit/Pick and Index to ensure the operation produced the expected type.
import{Type}from'@sinclair/typebox'constT=Type.Object({x: Type.Number(),y: Type.Number()})// As of 0.32.x...constA=Type.Pick(T,['z'])// TObject<{}>constB=Type.Omit(T,['z'])// TObject<{ a: TNumber, b: TNumber }>constC=Type.Index(T,['z'])// TNever
Hope this provides some insight into the change. Will close off this issue for now, but if you have any additional questions on the above, feel free to ping on this thread.
I've noticed that when using TypeScript in our project, the IDE doesn't suggest props when utilizing the Pick or Omit methods. I have a feeling that this functionality used to be available before.
Any insights on why this feature is no longer working or if I may be mistaken about its previous availability
The text was updated successfully, but these errors were encountered: