Type 'typeof h' has no call signatures.
Stencil version:
@stencil/[email protected]
I'm submitting a:
[ X ] bug report
Current behavior:
It's not possible to call h("tag-name") without casting it to any before.
Typescript return a compile error
This expression is not callable.
Type 'typeof h' has no call signatures.
Expected behavior:
calling h("tag-name") works fine
Steps to reproduce:
Just try to call h("tag-name") in any component
Are there any updates on this issue? I'm having trouble with this as well
BREAKING_CHANGES.md states that h is equivalent to React's React.createElement with following example:
const jsx = <ion-button>;
// is the same as:
const jsx = h('ion-button', null, null);
I took a look and they are not equivalent.
I'm facing an issue in where I can't render a component with props using h function.
-
React.createElementtakes a second argument asprops: anyand then pass it to the component. - Stencil's
htakes a second argument asdata: vNodeDatameaning that onlyclass|className|styleattributes will be passed to the component. as seen here leaving behind any other given keys in the props object.
Is there a way to achieve the same behavior as in React.createElement?
I'm just want to mount my kitchen sink components dynamically from a set of mocks, like this:
import { mocks } from 'components/index';
...
render() {
return (
<div>
{mocks.map(({ children, ...props }) => h(tag, props, children))}
</div>
);
}
Hi @Leandro-Albano 👋
Thanks for logging this issue and sorry it's sat for so long! I just ran a quick check in the latest version of Stencil and didn't run into any type of compiler warnings. If you're still experiencing issues, please update the issue with a minimum reproduction repo. Otherwise, the team will look to close out this issue in the near future. Thanks in advance!
Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.
Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.
For a guide on how to create a good reproduction, see our Contributing Guide.
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.
Thank you for using Stencil!