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.
I'm curious what the impact would be on the TS codebase, of inlining "our own" regular enums, i.e. all enums except those from other packages?
That's what I've done in the first commit. We could then, optionally:
--preserveConstEnums
option (all const enums having been rewritten, regular enums are preserved anyway)That's what I've done in the second commit --- or we could omit that change if there's some remaining distinction/advantage to const enums, apart from inlining?
To inline all "our own" enums, I changed the inlining condition as follows:
i.e. inline enums if:
The advantage of inlining "our own" regular enums is that you have the option of avoiding const enums, which prevent project references from being built with
--isolatedModules
. That's because project references use .d.ts files,--declaration
turns non-ambient const enums into ambient const enums, and ambient const enums are incompatible with single-file transpilation (--isolatedModules
).