File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
testdata/tests/cases/compiler Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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 > } ) ;
You can’t perform that action at this time.
0 commit comments