Skip to content

Commit

Permalink
export types
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 25, 2023
1 parent 4e94f4e commit 373cbfe
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { H3Event } from "../event";
import { createError } from "../error";
import { parse as parseMultipartData } from "./internal/multipart";
import { assertMethod, getRequestHeader } from "./request";
import { ValidateFunction, validateData } from "./internal/validate";
import { ValidateFunction, validateData } from "./validate";

export type { MultiPartData } from "./internal/multipart";

Expand Down
2 changes: 2 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from "./response";
export * from "./session";
export * from "./cors";
export * from "./sanitize";

export { ValidateFunction, ValidateResult } from "./validate";
2 changes: 1 addition & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getQuery as _getQuery } from "ufo";
import { createError } from "../error";
import type { HTTPMethod, RequestHeaders } from "../types";
import type { H3Event } from "../event";
import { validateData, ValidateFunction } from "./internal/validate";
import { validateData, ValidateFunction } from "./validate";

export function getQuery(event: H3Event) {
return _getQuery(event.path || "");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/internal/validate.ts → src/utils/validate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createError } from "../../error";
import { createError } from "../error";

// TODO: Consider using similar method of typeschema for external library compatibility
// https://github.com/decs/typeschema/blob/v0.1.3/src/assert.ts
Expand Down
3 changes: 1 addition & 2 deletions test/validate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import {
eventHandler,
readValidatedBody,
getValidatedQuery,
ValidateFunction,
} from "../src";
// TODO: Export
import { ValidateFunction } from "../src/utils/internal/validate";

// Custom validator
const customValidate: ValidateFunction<{
Expand Down

0 comments on commit 373cbfe

Please sign in to comment.