File: codeFixConvertTypedefToType7.ts

package info (click to toggle)
node-typescript 5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 497,488 kB
  • sloc: javascript: 2,107,274; makefile: 6; sh: 1
file content (75 lines) | stat: -rw-r--r-- 1,496 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/// <reference path='fourslash.ts' />

////
//// /**
////  * @typedef {number} FooNum
////  */
////
//// /**
////  * Comment above
////  * the typedef
////  *
////  * @typedef {(number|string|undefined)} FooSome
////  */
////
//// /**
////  * @typedef {string} Foo1
////  *
////  * @typedef FooPerson
////  * type {object}
////  * @property {string} id - person's ID
////  * @property name {string} // person's name
////  * @property {number|undefined} age - person's age
////  *
////  * @see another content
////  *
////  * @typedef {object} AnotherFooPerson
////  * @property {object} data
////  * @property {string} data.name
////  * @property {number} data.age
////  * @property {object} data.contact
////  * @property {string} data.contact.address
////  * @property {string} [data.contact.phone]
////  *
////  *
////  * @extends another content
////  */
////

verify.codeFixAll({
  fixId: 'convertTypedefToType',
  fixAllDescription: ts.Diagnostics.Convert_all_typedef_to_TypeScript_types.message,
  newFileContent: `
type FooNum = number;

/**
 * Comment above
 * the typedef
 */
type FooSome = (number | string | undefined);

type Foo1 = string;

interface FooPerson {
    id: string;
    name: string;
    age: number | undefined;
}
/**
 * @see another content
 */
interface AnotherFooPerson {
    data: {
        name: string;
        age: number;
        contact: {
            address: string;
            phone?: string;
        };
    };
}
/**
 * @extends another content
 */
`,
});