-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
haunted components are not instanceof HTMLElement
#127
Comments
Very bizarre, could this be because of the Proxy I guess? I'll look into it. |
Fix is coming in #128 . I would think this behavior would be the default with Proxys. Surprising. Learned something new today! |
Published in https://github.com/matthewp/haunted/releases/tag/v4.5.3 . Thanks again for the heads up! |
Thanks for a quick fix! I find this behavior in ES Proxies strange and confusing as well. But thanks to this issue I've learned something about Proxies, and also about the haunted library. It looks cool! Keep up the good work! |
Not sure if related to this issue or a different issue, but in the type declarations const defaultValue = '';
const Context = createContext(defaultValue);
// this does not work
customElements.define('provider', Context.Provider);
// this works
customElements.define('provider', Context.Provider as ComponentConstructor<{} & string & HTMLElement>); The compile error
I tried to play around with {
"target": "ESNext",
"lib": [
"DOM",
"ESNext"
],
"allowJs": false,
"experimentalDecorators": true,
"skipLibCheck": true,
"strict": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"resolveJsonModule": true
} Using latest Typescript at the time of writing |
Custom Elements returned by the
component
function do not pass theinstanceof HTMLElement
check. This is not what I would expect from a DOM element, and that might break other code (see vaadin/router#372).Example (see full in CodeSandbox):
See a more detailed investigation in vaadin/router#372 (comment)
Expected behavior:
All components created through haunted's
component()
function do pass theinstanceof HTMLElement
check in all browsers.The text was updated successfully, but these errors were encountered: