TypeScript/tests/cases/compiler/destructuringInitializerContextualTypeFromContext.ts
2018-12-28 09:38:19 -10:00

27 lines
559 B
TypeScript

// @strict: true
interface SFC<P = {}> {
(props: P & { children?: any }): any | null;
}
interface Props {
name: "Apollo" | "Artemis" | "Dionysus" | "Persephone";
}
const Parent: SFC<Props> = ({
children,
name = "Artemis",
...props
}) => Child({name, ...props});
const Child: SFC<Props> = ({
children,
name = "Artemis",
...props
}) => `name: ${name} props: ${JSON.stringify(props)}`;
// Repro from #29189
declare function f(g: (as: string[]) => void): void
f(([_1, _2 = undefined]) => undefined)