diff --git a/src/transformer/descriptor/tsLibs/typecriptLibs.ts b/src/transformer/descriptor/tsLibs/typecriptLibs.ts index 83fa84a72..9c93f0f8e 100644 --- a/src/transformer/descriptor/tsLibs/typecriptLibs.ts +++ b/src/transformer/descriptor/tsLibs/typecriptLibs.ts @@ -46,6 +46,8 @@ export function GetTypescriptTypeDescriptor(node: ts.TypeReferenceNode, scope: S [], [dataResolved], ); + case(TypescriptLibsTypes.Date): + return ts.createNew(ts.createIdentifier('Date'), undefined, undefined); case(TypescriptLibsTypes.Map): return ts.createNew(ts.createIdentifier('Map'), undefined, undefined); case(TypescriptLibsTypes.Set): diff --git a/src/transformer/descriptor/tsLibs/typescriptLibsTypes.ts b/src/transformer/descriptor/tsLibs/typescriptLibsTypes.ts index 4cedec570..3e7304683 100644 --- a/src/transformer/descriptor/tsLibs/typescriptLibsTypes.ts +++ b/src/transformer/descriptor/tsLibs/typescriptLibsTypes.ts @@ -1,14 +1,15 @@ export enum TypescriptLibsTypes { Array = 'Array', - ReadonlyArray = 'ReadonlyArray', - Number = 'Number', - String = 'String', Boolean = 'Boolean', - Object = 'Object', + Date = 'Date', Function = 'Function', - Promise = 'Promise', Map = 'Map', - Set = 'Set' + Number = 'Number', + Object = 'Object', + Promise = 'Promise', + ReadonlyArray = 'ReadonlyArray', + Set = 'Set', + String = 'String', } export const TypescriptLibsTypesFolder: string = 'node_modules/typescript/lib'; diff --git a/test/transformer/descriptor/tsLibs/tsLibs.test.ts b/test/transformer/descriptor/tsLibs/tsLibs.test.ts index 5999aba7f..5ba03897f 100644 --- a/test/transformer/descriptor/tsLibs/tsLibs.test.ts +++ b/test/transformer/descriptor/tsLibs/tsLibs.test.ts @@ -66,13 +66,13 @@ describe('typescript lib', () => { expect(properties.a).toEqual([]); }); - it('should set undefined for a Date', () => { + it('should create a new Date for a Date', () => { interface Interface { a: Date; } const properties: Interface = createMock(); - expect(properties.a).toBeUndefined(); + expect(properties.a).toBeInstanceOf(Date); }); it('should set a promise resolved for a promise', async () => {