Skip to content
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

Types for FunctionalComponent doesn't allow returning just children #3672

Closed
1 task
oliverfindl opened this issue Aug 16, 2022 · 1 comment · Fixed by #3676
Closed
1 task

Types for FunctionalComponent doesn't allow returning just children #3672

oliverfindl opened this issue Aug 16, 2022 · 1 comment · Fixed by #3676
Labels

Comments

@oliverfindl
Copy link

  • Check if updating to the latest Preact version resolves the issue.

Describe the bug:
FunctionalComponent doesn't allow returning just children, although code compiles successfully (with // @ts-ignore) and works as expected.

To Reproduce:

// DummyComponent.tsx

import { FunctionalComponent, h } from "preact";

const DummyComponent: FunctionalComponent = ({ children }) => {
    return children;
});

export default DummyComponent;

Error in VS Code:
Type 'ComponentChildren' is not assignable to type 'VNode<any> | null'.

Expected behavior:
No errors.

@developit
Copy link
Member

I've run into this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants