Type guard to check if a given value is a Standard Schema V1 object.
isStandardSchema<
Input = unknown,
Output = Input
>(schema: StandardSchemaV1<Input, Output>): schema is StandardSchemaV1<Input, Output>A Standard Schema object is expected to have a ~standard property with a validate function.
This guard does NOT check for JSON schema support.
| Name | Type | Description |
|---|---|---|
schema* | StandardSchemaV1<Input, Output> | The value to test. |
if (isStandardSchema(mySchema)) {
const result = mySchema["~standard"].validate(input);
}