File: tsxReactComponentWithDefaultTypeParameter3.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 (44 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React

interface Prop {
    a: number,
>a : number

    b: string
>b : string
}

declare class MyComp<P extends Prop> extends React.Component<P, {}> {
>MyComp : MyComp<P>
>React.Component : React.Component<P, {}>
>React : typeof React
>Component : typeof React.Component

    internalProp: P;
>internalProp : P
}

// Error
let x1 = <MyComp />
>x1 : JSX.Element
><MyComp /> : JSX.Element
>MyComp : typeof MyComp

// OK
let x = <MyComp a={10} b="hi" />
>x : JSX.Element
><MyComp a={10} b="hi" /> : JSX.Element
>MyComp : typeof MyComp
>a : number
>10 : 10
>b : string

// Error
let x2 = <MyComp a="hi"/>
>x2 : JSX.Element
><MyComp a="hi"/> : JSX.Element
>MyComp : typeof MyComp
>a : string