TypeScript/tests/baselines/reference/checkJsxChildrenProperty4.types
Anders Hejlsberg 6aeb8c12cc
Preserve type aliases for union and intersection types (#42149)
* Create separate types for equivalent aliased unions

* Accept new baselines

* Preserve original types for union types

* Accept new baselines

* Preserve intersection origin for union types

* Accept new baselines

* Accept new baselines

* Preserve aliases during relationship checks

* Accept new baselines

* Preserve aliases for intersection and indexed access types

* Accept new baselines

* Compute intersection-of-unions cross product without recursion

* Accept new baselines

* Use denormalized type objects for origin / support 'keyof' origins

* Accept new baselines

* Fix fourslash test

* Recursively extract named union types

* Accept new baselines

* Map on union origin in mapType to better preserve aliases and origins

* Remove redundant call

* Accept new baselines

* Revert back to declared type when branches produce equivalent union

* Accept new baselines

* Don't include denormal origin types in regular type statistics

* Fix issue with unions not being marked primitive-only

* Allow new alias to be associated with type alias instantiation

* Accept new baselines

* Revert "Accept new baselines"

This reverts commit 4507270cc1.

* Revert "Allow new alias to be associated with type alias instantiation"

This reverts commit 2c2d06dfe1.
2021-01-08 15:19:58 -10:00

126 lines
3.4 KiB
Plaintext

=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
interface IUser {
Name: string;
>Name : string
}
interface IFetchUserProps {
children: (user: IUser) => JSX.Element;
>children : (user: IUser) => JSX.Element
>user : IUser
>JSX : any
}
class FetchUser extends React.Component<IFetchUserProps, any> {
>FetchUser : FetchUser
>React.Component : React.Component<IFetchUserProps, any>
>React : typeof React
>Component : typeof React.Component
render() {
>render : () => JSX.Element
return this.state
>this.state ? this.props.children(this.state.result) : null : JSX.Element
>this.state : any
>this : this
>state : any
? this.props.children(this.state.result)
>this.props.children(this.state.result) : JSX.Element
>this.props.children : ((user: IUser) => JSX.Element) & React.ReactNode
>this.props : IFetchUserProps & { children?: React.ReactNode; }
>this : this
>props : IFetchUserProps & { children?: React.ReactNode; }
>children : ((user: IUser) => JSX.Element) & React.ReactNode
>this.state.result : any
>this.state : any
>this : this
>state : any
>result : any
: null;
>null : null
}
}
// Error
function UserName() {
>UserName : () => JSX.Element
return (
>( <FetchUser> { user => ( <h1>{ user.NAme }</h1> ) } </FetchUser> ) : JSX.Element
<FetchUser>
><FetchUser> { user => ( <h1>{ user.NAme }</h1> ) } </FetchUser> : JSX.Element
>FetchUser : typeof FetchUser
{ user => (
>user => ( <h1>{ user.NAme }</h1> ) : (user: IUser) => JSX.Element
>user : IUser
>( <h1>{ user.NAme }</h1> ) : JSX.Element
<h1>{ user.NAme }</h1>
><h1>{ user.NAme }</h1> : JSX.Element
>h1 : any
>user.NAme : any
>user : IUser
>NAme : any
>h1 : any
) }
</FetchUser>
>FetchUser : typeof FetchUser
);
}
function UserName1() {
>UserName1 : () => JSX.Element
return (
>( <FetchUser> { user => ( <h1>{ user.Name }</h1> ) } { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> ) : JSX.Element
<FetchUser>
><FetchUser> { user => ( <h1>{ user.Name }</h1> ) } { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> : JSX.Element
>FetchUser : typeof FetchUser
{ user => (
>user => ( <h1>{ user.Name }</h1> ) : (user: IUser) => JSX.Element
>user : IUser
>( <h1>{ user.Name }</h1> ) : JSX.Element
<h1>{ user.Name }</h1>
><h1>{ user.Name }</h1> : JSX.Element
>h1 : any
>user.Name : string
>user : IUser
>Name : string
>h1 : any
) }
{ user => (
>user => ( <h1>{ user.Name }</h1> ) : (user: IUser) => JSX.Element
>user : IUser
>( <h1>{ user.Name }</h1> ) : JSX.Element
<h1>{ user.Name }</h1>
><h1>{ user.Name }</h1> : JSX.Element
>h1 : any
>user.Name : string
>user : IUser
>Name : string
>h1 : any
) }
</FetchUser>
>FetchUser : typeof FetchUser
);
}