You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(dts-generator): change how enums are referenced in the generated… (#478)
feat(dts-generator): add special generation for deprecated enums
To improve compatibility with existing code, deprecated enums that are
aliases for new, non-deprecated enums are now generated as a re-export.
- a directives file (.dtsgenrc) may now contain a map
`deprecatedEnumAliases` which maps from deprecated enum name to
the new name
- when ESM types are generated, such deprecated enums are generated as
a re-export of the new enum. A re-export preserves both, the type and
the object nature of the enum.
- when global types are generated, nothing changed as there's no
equivalent to the re-export when using namespaces
- additionally, the type alternative of using literals instead of enum
values is no longer generated for the return type of a function,
but it's now also generated for the type aliases, as long as they're
not used as return type
---------
Co-authored-by: akudev <[email protected]>
Copy file name to clipboardExpand all lines: packages/dts-generator/docs/TECHNICAL.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,7 @@ Using `directives` as input and the information whether modules or globals shoul
52
52
-`convertNamespacesIntoTypedefsOrInterfaces` converts namespaces which are used as substitute for static objects into something else (static object or typedef); contains hardcoded knowledge about sap.ui.Device and uses "namespacesToInterfaces" directive; examples: 'jQuery.sap.PseudoEvents', 'jQuery.sap.storage', 'module:sap/base/Log', 'sap.ui.base.BindingInfo', 'sap.ui.core.AppCacheBuster', 'sap.ui.core.BusyIndicator' to object and 'sap.ui.core.AbsoluteCSSSize', 'sap.ui.core.Collision', 'sap.ui.core.CSSColor', 'sap.ui.core.Dock', 'sap.ui.core.URI' to typedef.
53
53
-`determineMissingExportsForTypes` adds exports for typedefs and interfaces where they are needed for the designtime - they are so far omitted because not needed at runtime
54
54
-`parseTypeExpressions` converts all type expressions into a TypeScript AST
55
+
-`markDeprecatedAliasesForEnums` marks enums (based on the directives) which are deprecated and should only be generated as alias for the new replacement enum
55
56
-`addForwardDeclarations` (from directives) - this relates to inverse dependencies
56
57
-`addInterfaceWithModuleNames` adds all visible modules to `sap.IUI5DefineDependencyNames`, which is merged across libraries from TypeScript perspective and can be used to type module imports
57
58
-`addConstructorSettingsInterfaces` and `addEventParameterInterfaces` create two additional interfaces defining important structures:
0 commit comments