Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider deprecating nominal-typebox #132

Open
SebastienGllmt opened this issue Oct 30, 2024 · 1 comment
Open

Consider deprecating nominal-typebox #132

SebastienGllmt opened this issue Oct 30, 2024 · 1 comment
Labels
triage Has to be reviewed by maintainers

Comments

@SebastienGllmt
Copy link

SebastienGllmt commented Oct 30, 2024

Is your feature request related to a problem? Please describe.

The current nominal-typebox implementation is fragile because it copies a lot of Typebox code as-is just to replace the static field

Describe the solution you'd like

Since nominal-typebox was written, a new feature called Type.Unsafe was added to Typebox which allows easily overriding the static property without having to do copy a bunch of Typebox internals like this library does now

For example, in my code instead of using nomial-typebox I just do

export type HexStringNo0x = FastFlavor<string, 'HexStringNo0x'>;

// this gives the same result as the nomial-typebox library, but with no dependency required
const HexStringNo0xTypebox = Type.Unsafe<HexStringNo0x>(Type.RegExp(/^[a-fA-F0-9]+$/)),
@SebastienGllmt SebastienGllmt added the triage Has to be reviewed by maintainers label Oct 30, 2024
Copy link

🥳 Thank you for opening your first issue for Coder-Spirit/nominal ! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Has to be reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant