spatie / typescript-transformer

Transform PHP types to TypeScript
https://docs.spatie.be/typescript-transformer/v2/introduction/
MIT License
275 stars 35 forks source link

feat(enum-collector): improve extensibility of `EnumTransformer` #78

Closed innocenzi closed 6 months ago

innocenzi commented 7 months ago

This pull request improves the extensibility of EnumTransformer.

Currently, EnumCollector is directly tied to EnumTransformer, which means that if we want to override the later, we also need to override the former.

With this pull request, the EnumCollector will check if there is a transformer that extends EnumTransformer instead of checking if EnumTransformer exists at all.

Additionally, the verification logic has been extracted to a method so it can be overridden if necessary.

The use case for this is the same as https://github.com/spatie/laravel-data/pull/589

innocenzi commented 6 months ago

@rubenvanassche I know v3 is in the works, but would it be possible to take a quick look at that for v2? 👀

rubenvanassche commented 6 months ago

We'll since it is going to take a few more weeks for v3 I'll merge it!