File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ const prefixTypeForSafety = (type: string) => {
100
100
typeof type === 'string' &&
101
101
! isPrimitive ( type ) &&
102
102
! isBuiltIn ( type ) &&
103
- ! / \( \| / gi. test ( type )
103
+ ! / [ \( \| ] / gi. test ( type )
104
104
) {
105
105
return `Electron.${ type } ` ;
106
106
}
Original file line number Diff line number Diff line change @@ -104,6 +104,30 @@ describe('utils', () => {
104
104
expect ( utils . typify ( 'buffer' ) ) . toEqual ( 'Buffer' ) ;
105
105
} ) ;
106
106
107
+ it ( 'should convert a promise with multiple inner types' , ( ) => {
108
+ expect (
109
+ utils . typify ( {
110
+ collection : false ,
111
+ innerTypes : [
112
+ {
113
+ collection : false ,
114
+ type : [
115
+ {
116
+ collection : false ,
117
+ type : 'number' ,
118
+ } ,
119
+ {
120
+ collection : false ,
121
+ type : 'null' ,
122
+ } ,
123
+ ] ,
124
+ } ,
125
+ ] ,
126
+ type : 'Promise' ,
127
+ } ) ,
128
+ ) . toEqual ( 'Promise<(number) | (null)>' ) ;
129
+ } ) ;
130
+
107
131
it ( 'should convert custom types with inner types' , ( ) => {
108
132
expect (
109
133
utils . typify ( {
You can’t perform that action at this time.
0 commit comments