Skip to content

Commit 342f985

Browse files
authored
feat: add new known VoidFunction type (#132)
* feat: add new known VoidFunction type * fix paren wrapping
1 parent 6c5184d commit 342f985

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ const typify = (type) => {
101101
return 'Buffer'
102102
case 'buffer[]':
103103
return 'Buffer[]'
104+
case 'voidfunction':
105+
return '(() => void)'
104106
case 'promise':
105107
if (innerType) {
106108
return `Promise<${innerType}>`

test/utils_spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ describe('utils', () => {
6161
expect(utils.typify('Number')).to.equal('number')
6262
})
6363

64+
it('should correctly convert a void function', () => {
65+
expect(utils.typify('VoidFunction')).to.equal('(() => void)')
66+
})
67+
6468
it('should lower case known array types', () => {
6569
expect(utils.typify('String[]')).to.equal('string[]')
6670
expect(utils.typify('Number[]')).to.equal('number[]')

0 commit comments

Comments
 (0)