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.
Related to #99
This pull request adds collector and transformer classes which can be used with the spatie/laravel-typescript-transformer package to generate typescript definitions from ValidatedDTO Classes.
This is especially useful when passing ValidatedDTOs through Inertia.js to a typescript based frontend.
Since this feature won't be used by everyone the
spatie/typescript-transformer
package is not added as a required dependency. Therefore to generate typescript definitions the user would need to complete the following steps.Step 1:
Install the
spatie/typescript-transformer
package.Step 2:
Publish the
typescript-transformer
configphp artisan vendor:publish --provider="Spatie\LaravelTypeScriptTransformer\TypeScriptTransformerServiceProvider"
Step 3:
Register the packages TypeScriptCollector and TypeScriptTransformer in the
typescript-transformer
configStep 4:
Run the command to generate the TypeScript types.
By default the definitions are added here:
resources/types/generated.d.ts
.