Reorganize types generated for typescript clients #4127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
This changes generated types in ts client bindings. We currently generate a few different types of types: reducer args, procedure args, rows, and user defined types. To avoid potential conflicts between these types (for example, if a user defined a type called
FooRow, and also had a tabled namedfoo, we would end up with two types namedFooRow), this puts each set of types in a different file and namespace. The main index file reexports each of those as its own namespace, so users can either import those namespaces or import specific types from the files. For example, if you had amessagetable and wanted the type of the rows, you could do either:or
This has a couple other changes:
Args, since we may want types for the return values in the future.export type Message = __Infer<typeof MessageRow>;). I couldn't think of a reason for users to want the schema object, so this should save users from needing to do all of theInferboilerplate.API and ABI breaking changes
This is a breaking change for v2.
Expected complexity level and risk
Testing