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

Typescript refactor #141

Merged
merged 50 commits into from
Jul 17, 2024
Merged

Typescript refactor #141

merged 50 commits into from
Jul 17, 2024

Conversation

justinvdm
Copy link
Collaborator

@justinvdm justinvdm commented Jul 10, 2024

Highlights

  • api and web are now fully typescript
  • this means ts type definitions are now exposed - so ts-based redwood projects should get type safety and autocompletion when they use redwoodjs-stripe
  • ts type definitions are generated from graphql queries and schema definitions, and used internally by redwoodjs-stripe/{api,web} for typechecking

Lower level context

  • the build scripts were changed such that they'll include the necessary codegen steps and type definitions building steps
    • we still generate runtime code the same way, and only use tsc for generating the type definitions
  • there are a bunch of changes and additions needed to the sdls to get the data to be compatible with what the stripe sdk is expecting
  • we do a bunch of null/undefined parsing when receiving data from the graphql api client side and providing it to the stripe sdk to fix types
    • for objects, if the value is null or undefined, we omit the corresponding property
    • for arrays, we filter out nulls
  • ideally what we need, is to generate the sdl types from stripe's own api types that they provide - this will probably mean we'll be able to avoid both further handwritten sdl maintenance, and this ^ parsing layer.
    • before investing time into that, probably first worth waiting out what happens with redwood's move to react server components (e.g. in case graphql is phased out of redwood)

@justinvdm justinvdm marked this pull request as ready for review July 16, 2024 19:02
@justinvdm justinvdm requested a review from chrisvdm July 16, 2024 19:03
@chrisvdm chrisvdm linked an issue Jul 16, 2024 that may be closed by this pull request
@chrisvdm chrisvdm merged commit 79dfa33 into main Jul 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript Support
2 participants