import React from 'react';
export const Tag: React.FC<{
tag: string;
[prop: string]: any;
}> = ({children, tag, ...props}) => React.createElement(tag, props, children);
keyof HTMLElementTagNameMap
interface StateProps {
a: number;
b: string;
c: boolean;
}
interface Action<P> {
payload: Partial<P>;
}
const f = <P>(state: P, { payload }: Action<P>): P => ({
...state,
...payload,
});
let nextState = f(
{ a: 0, b: '', c: true },
{ payload: { c: false } }
);
.tsx
.