Skip to content

What is the rational behind making v0.34 Type.Ref not allow passing in a schema and inferring the type? #1071

Answered by sinclairzx81
stuft2 asked this question in Q&A
Discussion options

You must be logged in to vote

@stuft2 Hi,

Why add the breaking change to Type.Ref in v0.34?

The change was made in support of the new Module feature which provides enhanced (and Safe) inference support for Ref. Unfortunately the previous Ref signature wasn't able to be repurposed in a way I felt comfortable maintaining moving forward (given conflicting designs). The updated signature on 0.34.0 is able to be made backwards compatible to 0.33.0, but the inverse wasn't possible. The call was made to drop the previous signature, but provide the fallback option via Unsafe.

Why not allow backwards compatibility?

You can replicate the old TRef using Unsafe (the following should work as before)

import { Type, TSchema, Static

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@sinclairzx81
Comment options

Answer selected by sinclairzx81
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@liu-ronny
Comment options

@sinclairzx81
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants