File: expandoFunctionContextualTypesJs.types

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (109 lines) | stat: -rw-r--r-- 2,907 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
=== tests/cases/compiler/input.js ===
/** @typedef {{ color: "red" | "blue" }} MyComponentProps */

/**
 * @template P 
 * @typedef {{ (): any; defaultProps?: Partial<P> }} StatelessComponent */

 /**
  * @type {StatelessComponent<MyComponentProps>}
  */
const MyComponent = () => /* @type {any} */(null);
>MyComponent : StatelessComponent<MyComponentProps>
>() => /* @type {any} */(null) : { (): any; defaultProps: Partial<MyComponentProps>; }
>(null) : null
>null : null

MyComponent.defaultProps = {
>MyComponent.defaultProps = {    color: "red"} : { color: "red"; }
>MyComponent.defaultProps : Partial<MyComponentProps>
>MyComponent : StatelessComponent<MyComponentProps>
>defaultProps : Partial<MyComponentProps>
>{    color: "red"} : { color: "red"; }

    color: "red"
>color : "red"
>"red" : "red"

};

const MyComponent2 = () => null;
>MyComponent2 : { (): any; defaultProps: MyComponentProps; }
>() => null : { (): any; defaultProps: MyComponentProps; }
>null : null

/**
 * @type {MyComponentProps}
 */
MyComponent2.defaultProps = {
>MyComponent2.defaultProps = {    color: "red"} : { color: "red"; }
>MyComponent2.defaultProps : MyComponentProps
>MyComponent2 : { (): any; defaultProps: MyComponentProps; }
>defaultProps : MyComponentProps
>{    color: "red"} : { color: "red"; }

    color: "red"
>color : "red"
>"red" : "red"
}

/**
  * @type {StatelessComponent<MyComponentProps>}
 */
const check = MyComponent2;
>check : StatelessComponent<MyComponentProps>
>MyComponent2 : { (): any; defaultProps: MyComponentProps; }

/**
 * 
 * @param {{ props: MyComponentProps }} p 
 */
function expectLiteral(p) {}
>expectLiteral : (p: {    props: MyComponentProps;}) => void
>p : { props: MyComponentProps; }

function foo() {
>foo : typeof foo

    /**
     * @type {MyComponentProps}
     */
    this.props = { color: "red" };
>this.props = { color: "red" } : { color: "red"; }
>this.props : MyComponentProps
>this : this
>props : MyComponentProps
>{ color: "red" } : { color: "red"; }
>color : "red"
>"red" : "red"

    expectLiteral(this);
>expectLiteral(this) : void
>expectLiteral : (p: { props: MyComponentProps; }) => void
>this : this
}

/**
 * @type {MyComponentProps}
 */
module.exports = {
>module.exports = {    color: "red"} : MyComponentProps
>module.exports : MyComponentProps
>module : { exports: MyComponentProps; }
>exports : MyComponentProps
>{    color: "red"} : { color: "red"; }

    color: "red"
>color : "red"
>"red" : "red"
}

expectLiteral({ props: module.exports });
>expectLiteral({ props: module.exports }) : void
>expectLiteral : (p: { props: MyComponentProps; }) => void
>{ props: module.exports } : { props: MyComponentProps; }
>props : MyComponentProps
>module.exports : MyComponentProps
>module : { exports: MyComponentProps; }
>exports : MyComponentProps