Skip to content

Commit

Permalink
Merge pull request #7 from maxholman/fetchimpl
Browse files Browse the repository at this point in the history
fix: overly strict types
  • Loading branch information
maxholman authored Aug 6, 2024
2 parents 6821e24 + 01bff50 commit 9c184d4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions lib/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import type { JsonifiableObject } from 'type-fest/source/jsonifiable.js';
import type { HttpMethod } from './types.js';

type Middleware<
CommandInput extends JsonifiableObject | undefined = never,
CommandOutput extends Jsonifiable | undefined = never,
CommandInput extends JsonifiableObject | undefined,
CommandOutput extends Jsonifiable | undefined,
> = (input: CommandInput, output: CommandOutput) => CommandOutput;

export abstract class Command<
CommandInput extends JsonifiableObject | undefined = never,
CommandOutput extends Jsonifiable | undefined = never,
CommandBody extends Jsonifiable | undefined = never,
CommandQuery extends JsonifiableObject | undefined = never,
CommandInput extends JsonifiableObject | undefined,
CommandOutput extends Jsonifiable | undefined,
CommandBody extends Jsonifiable | undefined,
CommandQuery extends JsonifiableObject | undefined,
> {
public method: HttpMethod = 'get';

Expand Down
4 changes: 2 additions & 2 deletions lib/rest-service-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export type RestServiceClientConfig = {
} & ({ fetcher?: FetcherMethod } | { fetch?: typeof globalThis.fetch });

export class RestServiceClient<
ClientInput extends JsonifiableObject | undefined = never,
ClientOutput extends Jsonifiable | undefined = never,
ClientInput extends JsonifiableObject | undefined,
ClientOutput extends Jsonifiable | undefined,
> {
readonly #base: URL;

Expand Down
8 changes: 4 additions & 4 deletions test/test1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
import { BillingCountry } from './fixtures/test1/types.js';

async function thisAlwaysThrows<
CommandInput extends JsonifiableObject | undefined = never,
CommandOutput extends Jsonifiable | undefined = never,
CommandBody extends Jsonifiable | undefined = never,
CommandQuery extends JsonifiableObject | undefined = never,
CommandInput extends JsonifiableObject | undefined,
CommandOutput extends Jsonifiable | undefined,
CommandBody extends Jsonifiable | undefined,
CommandQuery extends JsonifiableObject | undefined,
>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_: Command<CommandInput, CommandOutput, CommandBody, CommandQuery>,
Expand Down

0 comments on commit 9c184d4

Please sign in to comment.