Skip to content

Commit

Permalink
Fix #1131
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Nov 13, 2019
1 parent 87099f8 commit 6cdc62a
Show file tree
Hide file tree
Showing 5 changed files with 3,981 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib/models/types/predicate.ts
Expand Up @@ -83,7 +83,7 @@ export class PredicateType extends Type {
...super.toObject(),
name: this.name,
asserts: this.asserts,
targetType: this.targetType
targetType: this.targetType?.toObject()
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/serialization/serializers/types/predicate.ts
Expand Up @@ -13,7 +13,7 @@ export class PredicateTypeSerializer extends TypeSerializerComponent<PredicateTy
...obj,
name: type.name,
asserts: type.asserts,
targetType: type.targetType
targetType: type.targetType ? this.owner.toObject(type.targetType) : undefined
};
}
}
2 changes: 1 addition & 1 deletion src/test/converter.test.ts
Expand Up @@ -89,7 +89,7 @@ describe('Converter', function() {

it('matches specs', function() {
const specs = JSON.parse(FS.readFileSync(Path.join(path, 'specs.json')).toString());
let data = JSON.stringify(result!.toObject(), null, ' ');
let data = JSON.stringify(app.serializer.toObject(result), null, ' ');
data = data.split(normalizePath(base)).join('%BASE%');

compareReflections(JSON.parse(data), specs);
Expand Down
15 changes: 12 additions & 3 deletions src/test/converter/array/array.ts
@@ -1,8 +1,7 @@
/**
* A custom array interface.
*/
export interface Array<T>
{
export interface Array<T> {
}

/**
Expand All @@ -13,4 +12,14 @@ export const complex: ((Array<string>[] | number[])[] | string)[][] = [];
/**
* An exported const of the custom array type.
*/
export const custom: Array<number> = {};
export const custom: Array<number> = {};

/**
* Class array class item
*/
export class Foo {}

/**
* Custom list class
*/
export class FooList extends Array<Foo> {}

0 comments on commit 6cdc62a

Please sign in to comment.