-
-
Notifications
You must be signed in to change notification settings - Fork 739
Closed
Labels
questionQuestion about functionalityQuestion about functionality
Description
Search terms
global, export
Question
So I tried to find a way to document what is essentially a big "mess" around globals.
As a CE author I want to be able to document the usage of my CE without changing the implementation.
Ideally what I would like to do is the following:
// not exported on purpose, should only be available on global object as importing this would
// throw an "ce already defined" error
namespace Module {
export class MyCE extends HTMLElement {}
customElements.define("my-ce", MyCE); // side effect!
export namespace MyCE {
// types and utils specific to my custom element
}
}
declare global {
namespace globalThis {
// Apparently the only way to re-export a symbol without changing its type explicitly?
// other approaches include declaring the `typeof class` as a `var`, `let` or `const` or some
// variation thereof
/**
* documentation about the class itself
*/
export import MyCE = Module.MyCE;
}
interface HTMLElementTagNameMap {
/**
* documentation about the element
*/
"my-ce": Module.MyCE
}
}
Object.assign(globalThis, Module);
Do you see this happening in the future? Or should I rather change the doc tool here?
Metadata
Metadata
Assignees
Labels
questionQuestion about functionalityQuestion about functionality