Open TechQuery opened 1 week ago
Please provide a minimal reproduction, it's not fair to ask maintainers to browser through a full project.
Please provide a minimal reproduction, it's not fair to ask maintainers to browser through a full project.
@rschristian That repository is not a full project, it's just a scaffold with some simple example pages, but almost every page & component has the same type errors...
Anything more than a few files in src
is non-minimal. Please clear it out to the minimum that is required to demonstrate the issue.
This is the example StackBlitz we provide in the bug template, which is just about ideal for a web reproduction. For type errors you could certainly go even more minimal.
This is the example StackBlitz we provide in the bug template, which is just about ideal for a web reproduction.
Thanks, but Parcel 2.x is my real bundler, not Vite: https://codesandbox.io/p/devbox/preact-react-bootstrap-llqsv9?file=%2Fsrc%2Findex.tsx%3A5%2C14
Build tooling isn't likely to matter in a types issue, but regardless, it's just an example of scope that's appropriate. But thanks, the minimal repro does help.
Looks like we'll need to widen FunctionComponent
to return ComponentChild
as React does, but that seems to cause havoc in our tests:
- (props: RenderableProps<P>, context?: any): VNode<any> | null;
+ (props: RenderableProps<P>, context?: any): ComponentChild;
https://github.com/preactjs/preact/blob/eb3767723d43e8a38453efc28d187810edfa4231/src/index.d.ts#L90
Will need to play around with this for a bit.
Looks like we'll need to widen
FunctionComponent
to returnComponentChild
as React does, but that seems to cause havoc in our tests:- (props: RenderableProps<P>, context?: any): VNode<any> | null; + (props: RenderableProps<P>, context?: any): ComponentChild;
https://github.com/preactjs/preact/blob/eb3767723d43e8a38453efc28d187810edfa4231/src/index.d.ts#L90
My Web components engine may have the same issue😂
(PReact's JSX type definition is my major reference instead of confusing @types/react
, I have a big thank to you guys.)
Describe the bug
Every React Bootstrap component with Preact has a similar error as shown below:
To Reproduce
Steps to reproduce the behavior
git clone https://github.com/idea2app/React-MobX-Bootstrap-ts
npm i
npx tsc --noEmit
Expected behavior
No type errors as React does.