From f668da13f40cd2bc7ac2e21aea19fb11c8559432 Mon Sep 17 00:00:00 2001 From: Izik Lisbon Date: Wed, 9 Aug 2017 00:01:33 -0700 Subject: [PATCH] Sequelize is using Validator to validate that a string is a UUID. Validator supports 4 versions of UUID: https://github.com/chriso/validator.js/blob/b59133b1727b6af355b403a9a97a19226cceb34b/lib/isUUID.js#L14-L19 Update Sequelize's typescript to include `all` and change `number` type to a more specific type (3|4|5). Update Validator's typescript to be more specific. instead of `string | number` set the enum values (3|4|5|all) --- types/sequelize/index.d.ts | 2 +- types/sequelize/v3/index.d.ts | 2 +- types/validator/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index e767118394..5bb602388a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -4765,7 +4765,7 @@ declare namespace sequelize { /** * only allow uuids */ - isUUID?: number | { msg: string, args: number }; + isUUID?: 3|4|5|"3"|"4"|"5"|"all" | { msg: string, args: number }; /** * only allow date strings diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 0e3a27a4e4..6d55a66b5a 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -4661,7 +4661,7 @@ declare namespace sequelize { /** * only allow uuids */ - isUUID?: number | { msg: string, args: number }; + isUUID?: 3|4|5|"3"|"4"|"5"|"all" | { msg: string, args: number }; /** * only allow date strings diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 7c7283ebee..4dfa7dff1c 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -156,7 +156,7 @@ declare namespace ValidatorJS { isURL(str: string, options?: IsURLOptions): boolean; // check if the string is a UUID. Must be one of ['3', '4', '5', 'all'], default is all. - isUUID(str: string, version?: string | number): boolean; + isUUID(str: string, version?: 3|4|5|"3"|"4"|"5"|"all"): boolean; // check if the string is uppercase. isUppercase(str: string): boolean;