[X] I have searched existing issues to ensure the issue has not already been raised
Issue
Recently I hit an issue where I was unable to update Typebox's FormatRegistry. I had found #84 and #132 but for some reason my code wasn't working correctly until on a whim I changed my import from import { FormatRegistry } from '@sinclair/typebox'; to import { FormatRegistry } from "@fastify/type-provider-typebox";. Importing from the type provider package rather than typebox itself fixed everything.
In retrospect the reason is I have @sinclair/typebox 0.33.11 specified but the peerDep is ..., <= 0.33 causing multiple versions of @sinclair/typebox to be installed (see npm ls output at bottom of issue if you're curious).
I think it would be good to add a section to the README towards the end suggesting how to setup and use FormatRegistry and specifically call out importing from @fastify/type-provider-typebox (and not typebox directly) to avoid potential dupe package install issues.
I am happy to and will write this subsection in a follow-up PR, but I wanted to post as an issue first and get some discussion to get some feedback given that this would move this package to being slightly more opinionated in downstream usage.
As an additional question that I can definitely break off into a separate issue to file, do we want to make the peer dep slightly less restrictive?
Prerequisites
Issue
Recently I hit an issue where I was unable to update Typebox's FormatRegistry. I had found #84 and #132 but for some reason my code wasn't working correctly until on a whim I changed my import from
import { FormatRegistry } from '@sinclair/typebox';
toimport { FormatRegistry } from "@fastify/type-provider-typebox";
. Importing from the type provider package rather than typebox itself fixed everything.In retrospect the reason is I have @sinclair/typebox
0.33.11
specified but the peerDep is..., <= 0.33
causing multiple versions of @sinclair/typebox to be installed (see npm ls output at bottom of issue if you're curious).I think it would be good to add a section to the README towards the end suggesting how to setup and use FormatRegistry and specifically call out importing from
@fastify/type-provider-typebox
(and not typebox directly) to avoid potential dupe package install issues.I am happy to and will write this subsection in a follow-up PR, but I wanted to post as an issue first and get some discussion to get some feedback given that this would move this package to being slightly more opinionated in downstream usage.
As an additional question that I can definitely break off into a separate issue to file, do we want to make the peer dep slightly less restrictive?
`npm ls @sinclair/typebox -ws` output
``` monorepo@0.1.0 /path/to/monorepo ├─┬api@0.1.0 -> ./services/api │ ├─┬ @fastify/type-provider-typebox@4.1.0 │ │ └── @sinclair/typebox@0.27.8 │ └── @sinclair/typebox@0.33.11 └─┬notifications@0.1.0 -> ./services/notifications └── @sinclair/typebox@0.33.11 ```