Skip to content

Commit e499213

Browse files
committed
Add regression test
1 parent 6ed1a1a commit e499213

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// @strict: true
2+
// @target: esnext
3+
// @noEmit: true
4+
// @jsx: preserve
5+
6+
// https://github.com/microsoft/typescript-go/issues/2703
7+
8+
/// <reference path="/.lib/react.d.ts" />
9+
10+
import * as React from 'react';
11+
12+
type BaseProps = { locale: string };
13+
14+
type Props<T extends BaseProps> = {
15+
children: (props: T) => React.ReactNode;
16+
} & T;
17+
18+
declare function Comp<T extends BaseProps>(props: Props<T>): JSX.Element;
19+
20+
const bp: BaseProps = { locale: 'en' };
21+
22+
// Error in ts-go: Type '(props: ...) => Element' is not assignable to
23+
// type '((props: ...) => ReactNode) & {}'.
24+
const el = <Comp {...bp}>{(props) => <div>{props.locale}</div>}</Comp>;
25+
26+
// But the equivalent non-JSX call works fine:
27+
Comp({ ...bp, children: (props) => <div>{props.locale}</div> });

0 commit comments

Comments
 (0)