@standard-schema/utils
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -1,2 +0,2 @@ | ||
import { v1 } from '@standard-schema/spec'; | ||
import { StandardSchemaV1 } from '@standard-schema/spec'; | ||
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
declare function getDotPath(issue: v1.StandardIssue): string | null; | ||
declare function getDotPath(issue: StandardSchemaV1.Issue): string | null; | ||
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
readonly issues: ReadonlyArray<v1.StandardIssue>; | ||
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>; | ||
/** | ||
@@ -27,5 +27,5 @@ * Creates a schema error with useful information. | ||
*/ | ||
constructor(issues: ReadonlyArray<v1.StandardIssue>); | ||
constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>); | ||
} | ||
export { SchemaError, getDotPath }; |
{ | ||
"name": "@standard-schema/utils", | ||
"description": "The official runtime utils for Standard Schema", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -39,3 +39,3 @@ "author": "Fabian Hiller", | ||
"devDependencies": { | ||
"@standard-schema/spec": "npm:@jsr/standard-schema__spec@1.0.0-beta.2", | ||
"@standard-schema/spec": "npm:@jsr/standard-schema__spec@1.0.0-beta.4", | ||
"@vitest/coverage-v8": "2.1.2", | ||
@@ -42,0 +42,0 @@ "tsup": "^8.3.0", |
@@ -18,6 +18,6 @@ # Standard Schema Utils | ||
```ts | ||
import type { v1 } from "@standard-schema/spec"; | ||
import type { StandardSchemaV1 } from "@standard-schema/spec"; | ||
import { getDotPath } from "@standard-schema/utils"; | ||
async function getFormErrors(schema: v1.StandardSchema, data: unknown) { | ||
async function getFormErrors(schema: StandardSchemaV1, data: unknown) { | ||
const result = await schema["~standard"].validate(data); | ||
@@ -49,9 +49,9 @@ const formErrors: string[] = []; | ||
```ts | ||
import type { v1 } from "@standard-schema/spec"; | ||
import type { StandardSchemaV1 } from "@standard-schema/spec"; | ||
import { SchemaError } from "@standard-schema/utils"; | ||
async function validateInput<TSchema extends v1.StandardSchema>( | ||
async function validateInput<TSchema extends StandardSchemaV1>( | ||
schema: TSchema, | ||
data: unknown, | ||
): Promise<v1.InferOutput<TSchema>> { | ||
): Promise<StandardSchemaV1.InferOutput<TSchema>> { | ||
const result = await schema["~standard"].validate(data); | ||
@@ -58,0 +58,0 @@ if (result.issues) { |
Sorry, the diff of this file is not supported yet
8886