Skip to content

Commit

Permalink
Merge pull request #8 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 70b2821 + ecda3b3 commit d6eb0d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ distclean: clean
rm -rf node_modules

.PHONY: test
test: node_modules
test: node_modules dist
pnpm exec vitest

.PHONY: test.update
Expand Down
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,
CommandOutput extends Jsonifiable | undefined,
CommandInput extends JsonifiableObject | undefined = never,
CommandOutput extends Jsonifiable | undefined = never,
> = (input: CommandInput, output: CommandOutput) => CommandOutput;

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

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

0 comments on commit d6eb0d4

Please sign in to comment.