diff --git a/src/utils.ts b/src/utils.ts index 2620630..c3c99c0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -293,7 +293,7 @@ export const isEmitter = (doc: ParsedDocumentationResult[0]) => { return false; }; export const isPrimitive = (type: string) => { - const primitives = ['boolean', 'number', 'any', 'string', 'void', 'null', 'unknown']; + const primitives = ['boolean', 'number', 'any', 'string', 'void', 'null', 'unknown', 'undefined']; return primitives.indexOf(type.toLowerCase().replace(/\[\]/g, '')) !== -1; }; export const isBuiltIn = (type: string) => { diff --git a/test/utils.spec.ts b/test/utils.spec.ts index fd7e7e4..521ab82 100644 --- a/test/utils.spec.ts +++ b/test/utils.spec.ts @@ -135,6 +135,21 @@ describe('utils', () => { }), ).toEqual('Foo'); }); + + it('should convert a Promise', () => { + expect( + utils.typify({ + collection: false, + innerTypes: [ + { + collection: false, + type: 'undefined', + }, + ], + type: 'Promise', + }), + ).toEqual('Promise'); + }); }); describe('paramify', () => {