Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/validate-unknown-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"schema-utils": patch
---

Type the `validate` options parameter as `unknown`.
4 changes: 2 additions & 2 deletions declarations/validate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export function needValidate(): boolean;
*/
/**
* @param {Schema} schema schema
* @param {object[] | object} options options
* @param {unknown} options options, an object or an array of objects
* @param {ValidationErrorConfiguration=} configuration configuration
* @param {PrecompiledCheck=} check precompiled check of the schema, so a valid value never compiles the schema
* @returns {void}
*/
export function validate(
schema: Schema,
options: object[] | object,
options: unknown,
configuration?: ValidationErrorConfiguration | undefined,
check?: PrecompiledCheck | undefined,
): void;
4 changes: 2 additions & 2 deletions src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ function filterErrors(errors) {

/**
* @param {Schema} schema schema
* @param {object[] | object} options options
* @param {unknown} options options, an object or an array of objects
* @returns {SchemaUtilErrorObject[]} array of error objects
*/
function validateObject(schema, options) {
Expand All @@ -459,7 +459,7 @@ function validateObject(schema, options) {

/**
* @param {Schema} schema schema
* @param {object[] | object} options options
* @param {unknown} options options, an object or an array of objects
* @param {ValidationErrorConfiguration=} configuration configuration
* @param {PrecompiledCheck=} check precompiled check of the schema, so a valid value never compiles the schema
* @returns {void}
Expand Down
Loading