spatie / typescript-transformer

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

Don't generate if an enum has no cases yet #87

Open jameshulse opened 3 weeks ago

jameshulse commented 3 weeks ago

We happen to have a placeholder backed enum in our code base with no cases yet.

The current output in our generated.d.ts when 'transform_to_native_enums' => false looks like:

declare namespace ... {
export type Placeholder = ; // Syntax error as nothing between '=' and ';'
}

This is a syntax error and might be causing type inference issues in the rest of our application.