File tree 4 files changed +13
-5
lines changed
4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ apiPromise.then(API => {
46
46
linter . lint ( outFile , output , configuration )
47
47
const result = linter . getResult ( )
48
48
49
- if ( result . failureCount === 0 ) {
49
+ if ( result . failureCount === 0 || process . argv . includes ( '--force-write' ) ) {
50
50
fs . writeFileSync ( outFile , output )
51
51
} else {
52
52
console . error ( 'Failed to lint electron.d.ts' )
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ const wrapComment = (comment) => {
25
25
return result . concat ( ' */' )
26
26
}
27
27
28
+ const prefixTypeForSafety = ( type ) => {
29
+ if ( type !== 'Object' && typeof type === 'string' && ! isPrimitive ( type ) && ! isBuiltIn ( type ) ) {
30
+ return `Electron.${ type } `
31
+ }
32
+ return type
33
+ }
34
+
28
35
const typify = ( type ) => {
29
36
// Capture some weird edge cases
30
37
const originalType = type
@@ -105,7 +112,7 @@ const typify = (type) => {
105
112
return '(() => void)'
106
113
case 'promise' :
107
114
if ( innerType ) {
108
- return `Promise<${ typify ( innerType [ 0 ] ) } >`
115
+ return `Promise<${ prefixTypeForSafety ( typify ( innerType [ 0 ] ) ) } >`
109
116
}
110
117
debug ( 'Promise with missing inner type, defaulting to any' )
111
118
return 'Promise<any>'
@@ -156,7 +163,8 @@ const isPrimitive = (type) => {
156
163
'boolean' ,
157
164
'number' ,
158
165
'any' ,
159
- 'string'
166
+ 'string' ,
167
+ 'void'
160
168
]
161
169
return primitives . indexOf ( type . toLowerCase ( ) . replace ( / \[ \] / g, '' ) ) !== - 1
162
170
}
Original file line number Diff line number Diff line change 6
6
"main" : " index.js" ,
7
7
"scripts" : {
8
8
"build" : " node cli.js" ,
9
- "demo" : " npm run build -- -o=electron.d.ts" ,
9
+ "demo" : " npm run build -- -o=electron.d.ts --force-write " ,
10
10
"prepublishOnly" : " npm run demo && npm run test-output" ,
11
11
"lint-output" : " tslint -c tslint.json -t verbose electron.d.ts --fix" ,
12
12
"test" : " mocha && standard --fix && npm run demo && npm run test-output && npm run lint-output" ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const mkdirp = require('mkdirp').sync
7
7
const os = require ( 'os' )
8
8
9
9
const downloadPath = path . join ( os . tmpdir ( ) , 'electron-api-tmp' )
10
- const ELECTRON_COMMIT = '241098c7d2fa04c5712c8f6512470a5249bb64b1 '
10
+ const ELECTRON_COMMIT = '2feb919143d3acd8c6cdd611e98be591db074a38 '
11
11
12
12
rm ( downloadPath )
13
13
You can’t perform that action at this time.
0 commit comments