Source class for Web Components
Illusive7Man opened this issue · 2 comments
I am trying to add a TypeScript class as a source for my custom element, but I can't figure out how to properly configure it.
Here's one of the things I've tried:
"name": "my-element",
"source": {
"module": "MyModule",
"symbol": "MyClass"
}
and this is a typescript file containing the class:
export declare module MyModule {
export class MyClass {
public Name: string;
public LastName: string;
}
}
I have also tried adding path in the "module" option,
Can someone instruct me on how to get a TypeScript class to work as a custom-element's source?
To be able to navigate to it, etc.?
Hi!
The module
can be the name of node_module
package or a relative path to a TS/JS file. The TS module
construct is not recognized. Is it possible for you to export the class from the "node_module" package? Or from a file?
That did it. Removed the module declaration and in the "module" field added the relative path to the .ts file from web-types.
Thanks!