Skip to content

Commit

Permalink
fix/typescript-types make sure typescript Object will return an empty…
Browse files Browse the repository at this point in the history
… object (#204)
  • Loading branch information
uittorio authored Jan 29, 2020
1 parent 1a55ed6 commit e56dd7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function TypescriptLibsTypeAdapter(node: ts.TypeReferenceNode, scope: Sco
case(TypescriptLibsTypes.Boolean):
return ts.createNode(ts.SyntaxKind.BooleanKeyword);
case(TypescriptLibsTypes.Object):
return ts.createNode(ts.SyntaxKind.TypeLiteral);
return ts.createNode(ts.SyntaxKind.ObjectKeyword);
case(TypescriptLibsTypes.Function):
const functionNode: ts.Node = ts.createNode(ts.SyntaxKind.VoidKeyword);
return ts.createFunctionTypeNode([], [], functionNode as ts.TypeNode);
Expand Down
8 changes: 8 additions & 0 deletions test/transformer/descriptor/tsLibs/tsLibs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ describe('typescript lib', () => {
expect(properties.a).toEqual({});
});

it('should set the default value for an Object', () => {
interface Interface {
a: Object;
}
const properties: Interface = createMock<Interface>();
expect(properties.a).toEqual({});
});

it('should set an empty function for a function', () => {
interface Interface {
a: Function;
Expand Down

0 comments on commit e56dd7e

Please sign in to comment.