Skip to content

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

@oliverfindl

Description

@oliverfindl
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions