Comments (6)
Hello @sachinraja ,
TS already released satisfies
in 4.9.
However, as longer as you don't need to use it, you don't have to update Typescript dependency of your library.
Moreover, consumers of your library, having their own TS 4.9 wouldn't see the warning I mentioned above, since your library would have it's own TS 4.8.4 version installed (as a sub-dependency needed for that particular purpose).
And the final piece. When TS 5.0 will be released, having some breaking changes and removed methods, your library would remain operational, since it would still operate the version defined in prod dependencies. It will work for those who'll be using TS 5 in their project as well.
So, in general and regarding Typescript, I see this approach more beneficial.
I'm going to do this in express-zod-api
, since I found the same problem.
However, consider this as just a suggestion and my humble opinion.
Best wishes.
from zod-to-ts.
Hey, thanks for opening this! I'm still not sure if I want to move it from a peer dependency though. What happens if TS implements a new operator like satisfies
? Would I also have to keep that version updated here and do a new release?
I'm ok with doing that but it doesn't feel right. It might be necessary though since TS doesn't follow semver.
from zod-to-ts.
what would be your decision on this and #24 ?
from zod-to-ts.
I'm leaning on no for this @RobinTail. I don't like forcing the consumer to use our version of TypeScript. I'd rather use stricter peer dependencies to enforce a certain version. In almost every project I use zod-to-ts
in, I don't want it to have its own version of TypeScript.
from zod-to-ts.
By making Typescript a prod dependency you do not affect the version of Typescript on consumer's side.
Consumer's Typescript is installed to /node_modules/typescript
, while Typescript used by your package (used by consumer) is installed to /node_modules/zod-to-ts/node_modules/typescript
.
So they are completely independent installations.
However, if what I've said doesn't sound convincing enough, please close this issue so I'd know what final decision you ended up making, as I need to make mine.
from zod-to-ts.
I don't like forcing the consumer to use our version of TypeScript.
and
I'd rather use stricter peer dependencies to enforce a certain version
these two statements contradict each other.
peer dependency — IS forcing the consumer to use certain TS version.
While I'm offering to have your own TS version installed for your package needs.
from zod-to-ts.
Related Issues (20)
- Does not handle ZodDiscriminatedUnion
- can convert preprocess to ts HOT 1
- export option in createTypeAlias HOT 2
- README should include printNode? HOT 1
- Update to typescript 5 HOT 1
- `nativeEnum()` value with description HOT 2
- Have the option to deeply include zod descriptions as jsdoc comments HOT 1
- Support for TS `Template Literal Types` HOT 1
- Inconsistencies between typescript versions in code and docs(Readme.md)
- Type instantiation is excessively deep and possibly infinite HOT 1
- Debug Failure. Unhandled SyntaxKind: Unknown
- Get input type? HOT 1
- Unable to get the correct type when I used `z.transform()` HOT 1
- .catch() evaluates to any
- Feature request:
- Conversion of `z.nativeEnum()` with negative number fails on TS v5.4
- Default values in jsdoc
- Request: option to include description as comments
- Feature request: Handle readonly types HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zod-to-ts.