Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/core/src/declarations/stencil-public-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ export interface FunctionalUtilities {
}

export interface FunctionalComponent<T = {}> {
(props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[] | null;
(props: T, children: VNode[], utils: FunctionalUtilities): VNode | null;
}

/**
Expand All @@ -873,12 +873,12 @@ export interface ChildNode {
*
* For further information: https://stenciljs.com/docs/host-element
*/
export declare const Host: FunctionalComponent<HostAttributes>;
export declare const Host: (props: HostAttributes) => VNode;

/**
* Fragment
*/
export declare const Fragment: FunctionalComponent<{}>;
export declare const Fragment: (props: {}) => VNode;

/* eslint-disable jsdoc/require-param, jsdoc/require-returns -- we don't want to JSDoc these overloads at this time */
/**
Expand All @@ -905,6 +905,7 @@ export declare namespace h {
): VNode;

export namespace JSX {
type Element = VNode;
interface IntrinsicElements extends LocalJSX.IntrinsicElements, JSXBase.IntrinsicElements {
[tagName: string]: any;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/runtime/_test_/jsx.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Fragment, h, Host, Prop, State } from '@stencil/core';
import { FunctionalComponent } from '@stencil/core';
import { newSpecPage } from '@stencil/core/testing';
import { expect, describe, it } from '@stencil/vitest';

Expand Down Expand Up @@ -65,10 +64,7 @@ describe('jsx', () => {
first?: string;
last?: string;
}
const FunctionalCmp: FunctionalComponent<FunctionalCmpProps> = ({
first = 'Kim',
last = 'Doe',
}) => (
const FunctionalCmp = ({ first = 'Kim', last = 'Doe' }: FunctionalCmpProps) => (
<div>
Hi, my name is {first} {last}.
</div>
Expand All @@ -77,7 +73,11 @@ describe('jsx', () => {
@Component({ tag: 'cmp-a' })
class CmpA {
render() {
return <FunctionalCmp />;
return (
<>
<FunctionalCmp />
</>
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/runtime/_test_/render-vdom.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ describe('render-vdom', () => {
class CmpA {
render() {
const H = () => {
return;
return null;
};
return <H />;
}
Expand All @@ -288,7 +288,7 @@ describe('render-vdom', () => {
render() {
const Tunnel = {
Provider: () => {
return;
return null;
},
};
return <Tunnel.Provider />;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/runtime/vdom/_test_/h.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ describe('h()', () => {
});

it('replaceAttributes should return the attributes for the node', () => {
const FunctionalCmp: d.FunctionalComponent = (_nodeData, children, util) => {
const FunctionalCmp = (_nodeData: any, children: d.VNode[], util: d.FunctionalUtilities) => {
return util.map(children, (child) => {
return {
...child,
Expand Down Expand Up @@ -461,7 +461,7 @@ describe('h()', () => {
const ReplacementCmp: d.FunctionalComponent = (nodeData, children) => {
return h('article', nodeData, h('p', null, ...children));
};
const FunctionalCmp: d.FunctionalComponent = (_nodeData, children, util) => {
const FunctionalCmp = (_nodeData, children, util) => {
return util.map(children, (child) => {
return {
...child,
Expand Down
Loading