-
Notifications
You must be signed in to change notification settings - Fork 28
Enums should go in a .ts file, not .d.ts #4
Comments
The current system doesn't generate .ts file, only definitions. So I am not sure if we should keep the enum system if TS 1.6 requires specific code. |
Problem may exist in TS 1.4/5 as well. Solution I implemented locally is just quick-and-dirty code to cut enums from end of .d.ts (as output from Proto2TypeScript) and pipe them into a .ts included in the project. Also replaced "export enum" with "export const enum". All seems to work fine with these two changes. Minor change and should be backwards compatible to TS < 1.6 as well. |
I ran into this. Started having a go at fixing it. Added a command-line option to make it write output to separate |
@DouglasHeriot is that work available somewhere? We're seeing this issue in cockroachdb/cockroach#6616. |
Ok – just pushed it to branch enums in my repo here: https://github.com/DouglasHeriot/Proto2TypeScript/tree/enums Haven’t looked at it for a while. I think I set up the basic stuff to have it run through the templates twice and output 2 separate files. Just need to actually write a separate set of templates that will only output the enums. (Curently, I think both output files are the same/similar – not correct at all) |
Current behaviour puts enum definitions in .d.ts. With TS 1.6 this can result in the definitions not making their way into any .js. Similar issue with similar tool (https://bitbucket.org/LukasKabrt/typelite/issues/17/enums-should-go-in-a-ts-file-not-dts) had them moving enums from .d.ts to a .ts. Can/should same be done in Proto2TypeScript?
The text was updated successfully, but these errors were encountered: