-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: support typescript config #110
feat: support typescript config #110
Conversation
@GabrielAnca any chance of getting this reviewed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @G-Rath 👋🏻 Sorry for the delay, I was out of the office last week. Thanks a lot for this contribution. I'll be happy to help you get this merged into production! The PR looks great so far!
I tried this in one of our repos and it doesn't work, and the error seems to point that we're using different versions of typescript/ts-node
$ contentful-typescript-codegen --output @types/generated/contentful.d.ts
Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
What versions of typescript and ts-node are you using? I'm using typescript 4.8.4 and ts-node 10.9.1
Are you sure you're using that version of One thing in particular to watch out for is that you don't have multiple versions of You can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could connect the dots now, thanks for all the clarification! I made a couple small comments. As soon as they're addressed I'll be happy to merge this 😄 This will also improve our own setup a lot! Thank you so much!
Looks great! Only one more thing: Let's also update the readme to document how to use a TypeScript file 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you so much for all the effort here 🚀🚀🚀
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is all pretty standard implementation wise but the types are not as exact as I'd like as it seems there's a difference between the types used by
contentful
itself &contentful-management
that make them incompatible.The beauty with this is that it's not an actual blocker, since we can improve the types over time 🎉
(I suspect that this package should be sourcing it's types from
contentful-management
rather thancontentful
, if it's expecting the former to be being used to create the client, but that'd be a different change - I'm happy to do the work in a follow up PR if folks are happy with that change)Resolves #33