2/14/2024 0 Comments Typescript includesVersion A and B’s enums can have different values, if you are not very careful, resulting in surprising bugs, like taking the wrong branches of if statements. You can easily inline values from version A of a dependency at compile time, and import version B at runtime.This means if you publish ambient const enums, downstream consumers will not be able to use isolatedModules and those enum values at the same time. For the reasons laid out in the isolatedModules documentation, that mode is fundamentally incompatible with ambient const enums.d.ts files, these pitfalls likely apply to you, because tsc -declaration transforms. d.ts files) and sharing them between projects, but if you are publishing or consuming. These pitfalls pertain to ambient const enums only (basically const enums in. Inlining enum values is straightforward at first, but comes with subtle implications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |