Skip to content

Commit

Permalink
fix: don't simplify return type
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 13, 2023
1 parent 81b7e1a commit 62d028d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/types/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RouterMethod } from "h3";
import type { FetchRequest, FetchOptions, FetchResponse } from "ofetch";
import type { Serialize, Simplify } from "./serialize";
import type { Serialize } from "./serialize";
import type { MatchedRoutes } from "./utils";

// An interface to extend in a local project
Expand All @@ -13,15 +13,12 @@ export type NitroFetchRequest =
// eslint-disable-next-line @typescript-eslint/ban-types
| (string & {});

// TODO: re-enable Simplify
export type MiddlewareOf<
Route extends string,
Method extends RouterMethod | "default"
> = Method extends keyof InternalApi[MatchedRoutes<Route>]
? Simplify<
Serialize<
Exclude<InternalApi[MatchedRoutes<Route>][Method], Error | void>
>
>
? Exclude<Serialize<InternalApi[MatchedRoutes<Route>][Method]>, Error | void>
: never;

export type TypedInternalResponse<
Expand Down

0 comments on commit 62d028d

Please sign in to comment.