Closed akudev closed 2 years ago
This is a draft for discussion, whether the overall approach is ok.
What I will do if the approach is accepted, before actually having it merged:
What I can do if requested:
What I would prefer not to do (as of now):
What it does: named exports annotated like this (first export in the code sample) are removed during transformation. Reasoning as described in https://github.com/r-murphy/babel-plugin-transform-modules-ui5/pull/66 and overall explained in https://github.com/SAP/ui5-typescript/issues/294.
/**
* @ui5designtimeonlyexport
*/
export { Example };
export { ThisStaysIn };
export default Example;
I think your proposal is a good compromise for the discussion in https://github.com/SAP/ui5-typescript/issues/294 and has a low impact on this plugin.
Not needed anymore as a way was found to make it work without named export.
Using a JSDoc comment with the newly introduced custom tag @ui5designtimeonlyexport the subsequent named export can be marked as "design-time only". This means it is only needed during development time for certain TypeScript mechanisms, but should not be present at runtime.
This implements a proposal discussed in https://github.com/r-murphy/babel-plugin-transform-modules-ui5/pull/66 to make the overall solution discussed in https://github.com/SAP/ui5-typescript/issues/294 prettier: For module merging needed in UI5 control development, the control class name needs to be a named export (in addition to being the default export). This is only needed at development time to make the TypeScript compiler recognize the additionally generated interface as enriching the control class.