File: checkJsxSubtleSkipContextSensitiveBug.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (57 lines) | stat: -rw-r--r-- 1,657 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
=== tests/cases/conformance/jsx/checkJsxSubtleSkipContextSensitiveBug.tsx ===
/// <reference path="react16.d.ts" />
import * as React from "react";
>React : typeof React

interface ErrorResult { error: true }
>error : true
>true : true

interface AsyncLoaderProps<TResult> {
    readonly prop1: () => Promise<TResult>;
>prop1 : () => Promise<TResult>

    readonly prop2: (result: Exclude<TResult, ErrorResult>) => any;
>prop2 : (result: Exclude<TResult, ErrorResult>) => any
>result : Exclude<TResult, ErrorResult>
}

class AsyncLoader<TResult> extends React.Component<AsyncLoaderProps<TResult>> {
>AsyncLoader : AsyncLoader<TResult>
>React.Component : React.Component<AsyncLoaderProps<TResult>, {}, any>
>React : typeof React
>Component : typeof React.Component

    render() { return null; }
>render : () => null
>null : null
}

async function load(): Promise<{ success: true } | ErrorResult> {
>load : () => Promise<ErrorResult | { success: true; }>
>success : true
>true : true

    return { success: true };
>{ success: true } : { success: true; }
>success : true
>true : true
}

const loader = <AsyncLoader
>loader : JSX.Element
><AsyncLoader    prop1={load}    prop2={result => result}/> : JSX.Element
>AsyncLoader : typeof AsyncLoader

    prop1={load}
>prop1 : () => Promise<ErrorResult | { success: true; }>
>load : () => Promise<ErrorResult | { success: true; }>

    prop2={result => result}
>prop2 : (result: { success: true; }) => { success: true; }
>result => result : (result: { success: true; }) => { success: true; }
>result : { success: true; }
>result : { success: true; }

/>;