Skip to content

Commit

Permalink
fix(type): typo in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Feb 20, 2023
1 parent 5c45586 commit 2a79e5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/type/src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ export class Serializer {

this.typeGuards.getRegistry(1).registerClass(Set, typeGuardClassSet);
this.typeGuards.getRegistry(1).registerClass(Map, typeGuardClassMap);
this.typeGuards.getRegistry(1).registerClass(Date, (type, state) => state.addSetterAndReportErrorIfInvalid('type', 'No a Date', `${state.accessor} instanceof Date`));
this.typeGuards.getRegistry(1).registerClass(Date, (type, state) => state.addSetterAndReportErrorIfInvalid('type', 'Not a Date', `${state.accessor} instanceof Date`));
this.typeGuards.getRegistry(0.5).registerClass(Date, (type, state) => {
state.addSetter(`'string' === typeof ${state.accessor} && new Date(${state.accessor}).toString() !== 'Invalid Date'`);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/type/tests/validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,5 @@ test('date', () => {
public name!: string;
public createdAt!: Date;
}
expect(validate<Account>({name: "jack", createdAt: 'asd'})).toEqual([{code: 'type', message: 'No a Date', path: 'createdAt'}]);
expect(validate<Account>({name: "jack", createdAt: 'asd'})).toEqual([{code: 'type', message: 'Not a Date', path: 'createdAt'}]);
});

0 comments on commit 2a79e5a

Please sign in to comment.