diff --git a/src/index.ts b/src/index.ts index 656ee09..ac5ebd8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,4 @@ -export default (options: { - tag: string - template: string - style?: string - onMount?: () => void - onUnmount?: () => void - onAttributeChanged?: (attrName: string, oldValue: string, newValue: string) => void -}) => { +export default (options: ComponentOptions) => { const { tag, template, style, onMount, onUnmount, onAttributeChanged } = options class CustomElement extends HTMLElement { diff --git a/src/types/ComponentOptions.d.ts b/src/types/ComponentOptions.d.ts new file mode 100644 index 0000000..0eaa9ad --- /dev/null +++ b/src/types/ComponentOptions.d.ts @@ -0,0 +1,8 @@ +interface ComponentOptions { + tag: string + template: string + style?: string + onMount?: () => void + onUnmount?: () => void + onAttributeChanged?: (attrName: string, oldValue: string, newValue: string) => void +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index c2ab235..bd46907 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,7 +32,7 @@ // "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. */ // "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. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */