File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ apiPromise.then(API => {
4646 linter . lint ( outFile , output , configuration )
4747 const result = linter . getResult ( )
4848
49- if ( result . failureCount === 0 ) {
49+ if ( result . failureCount === 0 || process . argv . includes ( '--force-write' ) ) {
5050 fs . writeFileSync ( outFile , output )
5151 } else {
5252 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) => {
2525 return result . concat ( ' */' )
2626}
2727
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+
2835const typify = ( type ) => {
2936 // Capture some weird edge cases
3037 const originalType = type
@@ -105,7 +112,7 @@ const typify = (type) => {
105112 return '(() => void)'
106113 case 'promise' :
107114 if ( innerType ) {
108- return `Promise<${ typify ( innerType [ 0 ] ) } >`
115+ return `Promise<${ prefixTypeForSafety ( typify ( innerType [ 0 ] ) ) } >`
109116 }
110117 debug ( 'Promise with missing inner type, defaulting to any' )
111118 return 'Promise<any>'
@@ -156,7 +163,8 @@ const isPrimitive = (type) => {
156163 'boolean' ,
157164 'number' ,
158165 'any' ,
159- 'string'
166+ 'string' ,
167+ 'void'
160168 ]
161169 return primitives . indexOf ( type . toLowerCase ( ) . replace ( / \[ \] / g, '' ) ) !== - 1
162170}
Original file line number Diff line number Diff line change 66 "main" : " index.js" ,
77 "scripts" : {
88 "build" : " node cli.js" ,
9- "demo" : " npm run build -- -o=electron.d.ts" ,
9+ "demo" : " npm run build -- -o=electron.d.ts --force-write " ,
1010 "prepublishOnly" : " npm run demo && npm run test-output" ,
1111 "lint-output" : " tslint -c tslint.json -t verbose electron.d.ts --fix" ,
1212 "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
77const os = require ( 'os' )
88
99const downloadPath = path . join ( os . tmpdir ( ) , 'electron-api-tmp' )
10- const ELECTRON_COMMIT = '241098c7d2fa04c5712c8f6512470a5249bb64b1 '
10+ const ELECTRON_COMMIT = '2feb919143d3acd8c6cdd611e98be591db074a38 '
1111
1212rm ( downloadPath )
1313
You can’t perform that action at this time.
0 commit comments