File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,19 @@ export const wrapComment = (comment: string, additionalTags: DocumentationTag[]
95
95
return result . concat ( ' */' ) ;
96
96
} ;
97
97
98
+ const prefixTypeForSafety = ( type : string ) => {
99
+ if (
100
+ type !== 'Object' &&
101
+ typeof type === 'string' &&
102
+ ! isPrimitive ( type ) &&
103
+ ! isBuiltIn ( type ) &&
104
+ ! / \( \| / gi. test ( type )
105
+ ) {
106
+ return `Electron.${ type } ` ;
107
+ }
108
+ return type ;
109
+ } ;
110
+
98
111
export const typify = (
99
112
type : TypeInformation | TypeInformation [ ] ,
100
113
maybeInnerReturnTypeName ?: string ,
@@ -211,7 +224,7 @@ export const typify = (
211
224
return '(() => void)' ;
212
225
case 'promise' :
213
226
if ( innerTypes ) {
214
- return `Promise<${ typify ( innerTypes [ 0 ] ) } >` ;
227
+ return `Promise<${ prefixTypeForSafety ( typify ( innerTypes [ 0 ] ) ) } >` ;
215
228
}
216
229
throw new Error ( 'Promise with missing inner type' ) ;
217
230
case 'record' :
You can’t perform that action at this time.
0 commit comments