Skip to content

Commit 36525c1

Browse files
authored
allow for null return from fc (#3683)
* allow for null * add test
1 parent 2b1930c commit 36525c1

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export type ComponentProps<
8787
: never;
8888

8989
export interface FunctionComponent<P = {}> {
90-
(props: RenderableProps<P>, context?: any): VNode<any>;
90+
(props: RenderableProps<P>, context?: any): VNode<any> | null;
9191
displayName?: string;
9292
defaultProps?: Partial<P>;
9393
}

test/ts/preact.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,5 @@ let elementProps: ComponentProps<'button'> = {
312312
// Typing of style property
313313
const acceptsNumberAsLength = <div style={{ marginTop: 20 }} />;
314314
const acceptsStringAsLength = <div style={{ marginTop: '20px' }} />;
315+
316+
const ReturnNull: FunctionalComponent = () => null;

0 commit comments

Comments
 (0)