Add ComponentOptions type definition and update index.ts to use it
This commit is contained in:
parent
8fe77f3b9b
commit
5a1d8469d6
|
@ -1,11 +1,4 @@
|
||||||
export default (options: {
|
export default (options: ComponentOptions) => {
|
||||||
tag: string
|
|
||||||
template: string
|
|
||||||
style?: string
|
|
||||||
onMount?: () => void
|
|
||||||
onUnmount?: () => void
|
|
||||||
onAttributeChanged?: (attrName: string, oldValue: string, newValue: string) => void
|
|
||||||
}) => {
|
|
||||||
const { tag, template, style, onMount, onUnmount, onAttributeChanged } = options
|
const { tag, template, style, onMount, onUnmount, onAttributeChanged } = options
|
||||||
|
|
||||||
class CustomElement extends HTMLElement {
|
class CustomElement extends HTMLElement {
|
||||||
|
|
8
src/types/ComponentOptions.d.ts
vendored
Normal file
8
src/types/ComponentOptions.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
interface ComponentOptions {
|
||||||
|
tag: string
|
||||||
|
template: string
|
||||||
|
style?: string
|
||||||
|
onMount?: () => void
|
||||||
|
onUnmount?: () => void
|
||||||
|
onAttributeChanged?: (attrName: string, oldValue: string, newValue: string) => void
|
||||||
|
}
|
|
@ -32,7 +32,7 @@
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
"typeRoots": ["./src/types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user