File tree Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,18 @@ const typify = (type) => {
39
39
40
40
if ( typeof type === 'object' ) {
41
41
let newType = type . typeName || type . type || 'any'
42
- if ( newType . toLowerCase ( ) === 'string' && type . possibleValues ) {
43
- newType = `(${ type . possibleValues . map ( value => `'${ value . value } '` ) . join ( ' | ' ) } )`
44
- }
45
- if ( type . collection ) {
46
- type = newType + '[]'
42
+
43
+ if ( newType . toLowerCase ( ) === 'string' && type . possibleValues && type . collection ) {
44
+ // Array<foo | bar> syntax instead of (foo | bar)[]
45
+ newType = `Array<${ type . possibleValues . map ( value => `'${ value . value } '` ) . join ( ' | ' ) } >`
47
46
} else {
48
- type = newType
47
+ if ( newType . toLowerCase ( ) === 'string' && type . possibleValues ) {
48
+ newType = `(${ type . possibleValues . map ( value => `'${ value . value } '` ) . join ( ' | ' ) } )`
49
+ }
50
+ if ( type . collection ) newType += '[]'
49
51
}
52
+
53
+ type = newType
50
54
}
51
55
52
56
switch ( type . toLowerCase ( ) ) {
Original file line number Diff line number Diff line change 11
11
"lint-output" : " tslint -c tslint.json -t verbose electron.d.ts --fix" ,
12
12
"test" : " mocha && standard && npm run test-output && npm run lint-output" ,
13
13
"pretest-output" : " npm run build -- -o=test-smoke/electron/index.d.ts && cd test-smoke/electron/test && rm -f *.js" ,
14
- "test-output" : " node scripts/lint.js && cd test-smoke/electron && tsc --project tsconfig.json"
14
+ "test-output" : " tslint electron.d.ts --format stylish && cd test-smoke/electron && tsc --project tsconfig.json"
15
15
},
16
16
"author" : {
17
17
"name" : " Samuel Attard" ,
22
22
"@types/node" : " ^7.0.5" ,
23
23
"chai" : " ^3.5.0" ,
24
24
"mocha" : " ^3.1.2" ,
25
- "standard" : " ^9.0.2" ,
26
- "tslint" : " ^4.5.1" ,
27
- "typescript" : " ^2.2.1"
25
+ "standard" : " ^9.0.2"
28
26
},
29
27
"standard" : {
30
28
"env" : {
38
36
"electron-docs-linter" : " ^2.3.0" ,
39
37
"lodash" : " ^4.16.1" ,
40
38
"mkdirp" : " ^0.5.1" ,
41
- "rimraf" : " ^2.5.4"
39
+ "rimraf" : " ^2.5.4" ,
40
+ "tslint" : " ^4.5.1" ,
41
+ "typescript" : " ^2.2.1"
42
42
}
43
43
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments