Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/query/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Err, Ok, type Result, resolve } from "../result/index.js";
* @template TData - The type of data returned by the query (after select transform)
* @template TQueryKey - The type of the query key
*/
export type DefineQueryInput<
type DefineQueryInput<
TQueryFnData = unknown,
TError = DefaultError,
TData = TQueryFnData,
Expand Down Expand Up @@ -69,7 +69,7 @@ export type DefineQueryInput<
* const query = useQuery(userQuery.options); // React
* ```
*/
export type DefineQueryOutput<
type DefineQueryOutput<
TQueryFnData = unknown,
TError = DefaultError,
TData = TQueryFnData,
Expand Down Expand Up @@ -99,7 +99,7 @@ export type DefineQueryOutput<
* @template TVariables - The type of variables passed to the mutation
* @template TContext - The type of context data for optimistic updates
*/
export type DefineMutationInput<
type DefineMutationInput<
TData,
TError,
TVariables = void,
Expand Down Expand Up @@ -140,7 +140,7 @@ export type DefineMutationInput<
* const mutation = useMutation(createUser.options); // React
* ```
*/
export type DefineMutationOutput<
type DefineMutationOutput<
TData,
TError,
TVariables = void,
Expand Down
28 changes: 0 additions & 28 deletions src/result/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,6 @@ export const Ok = <T>(data: T): Ok<T> => ({ data, error: null });
*/
export const Err = <E>(error: E): Err<E> => ({ error, data: null });

/**
* Utility type to extract the `Ok<T>` variant from a `Result<T, E>` union type.
*
* If `R` is a `Result` type (e.g., `Result<string, Error>`), this type will resolve
* to `Ok<string>`. This can be useful in generic contexts or for type narrowing.
*
* @template R - The `Result<T, E>` union type from which to extract the `Ok<T>` variant.
* Must extend `Result<unknown, unknown>`.
*/
export type ExtractOkFromResult<R extends Result<unknown, unknown>> = Extract<
R,
{ error: null }
>;

/**
* Utility type to extract the `Err<E>` variant from a `Result<T, E>` union type.
*
* If `R` is a `Result` type (e.g., `Result<string, Error>`), this type will resolve
* to `Err<Error>`. This can be useful in generic contexts or for type narrowing.
*
* @template R - The `Result<T, E>` union type from which to extract the `Err<E>` variant.
* Must extend `Result<unknown, unknown>`.
*/
export type ExtractErrFromResult<R extends Result<unknown, unknown>> = Extract<
R,
{ data: null }
>;

/**
* Utility type to extract the success value's type `T` from a `Result<T, E>` type.
*
Expand Down
1 change: 0 additions & 1 deletion src/standard-schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export { ResultSchema, type Result } from "./result.js";
export {
hasJsonSchema,
hasValidate,
type StandardFullSchemaV1,
type StandardJSONSchemaV1,
type StandardSchemaV1,
type StandardTypedV1,
Expand Down
12 changes: 0 additions & 12 deletions src/standard-schema/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,6 @@ export declare namespace StandardJSONSchemaV1 {
StandardTypedV1.InferOutput<Schema>;
}

// ###############################
// ### Utility Types ###
// ###############################

/**
* A schema that implements both StandardSchemaV1 and StandardJSONSchemaV1.
*/
export type StandardFullSchemaV1<Input = unknown, Output = Input> = {
readonly "~standard": StandardSchemaV1.Props<Input, Output> &
StandardJSONSchemaV1.Props<Input, Output>;
};

/**
* Checks if a schema has validation capability.
*/
Expand Down