I have this function declaration inside af module:
declare module 'picoapp' {
export function component(node?: HTMLElement): void
}
and then using it like this in a .ts file
export default component((node: HTMLElement) => {
// All sorts of TS/JS here
})
But VSCode gives me this warning: Argument of type '(node: HTMLElement) => void' is not assignable to parameter of type 'HTMLElement'
.
What should the returntype of the function then be? I'm not returning a value, but just using the node for reference.
If the usage of your component function is correct, the type should be declared as following where callback can be whatever name you prefer.
declare module 'picoapp' {
export function component(callback:(node?: HTMLElement)=>void): void
}