3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 22:05:01 +00:00

Validate basic plugin options structure and override criteria types

This commit is contained in:
Dragory 2020-07-30 00:29:44 +03:00
parent 70e072e664
commit ed757dcbe2
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 56 additions and 20 deletions

View file

@ -98,7 +98,7 @@ export function validate(schema: t.Type<any>, value: any): StrictValidationError
* Decodes and validates the given value against the given schema while also disallowing extra properties
* See: https://github.com/gcanti/io-ts/issues/322
*/
export function decodeAndValidateStrict(schema: t.HasProps, value: any): StrictValidationError | any {
export function decodeAndValidateStrict<T extends t.HasProps>(schema: T, value: any): StrictValidationError | any {
const validationResult = t.exact(schema).decode(value);
return pipe(
validationResult,