Sequelize is using Validator to validate that a string is a UUID. Validator supports 4 versions of UUID:

b59133b172/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)
This commit is contained in:
Izik Lisbon 2017-08-09 00:01:33 -07:00
parent 825d361b8e
commit f668da13f4
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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;