Skip to content

Commit

Permalink
fix(types): use undefined instead of void return type (#5)
Browse files Browse the repository at this point in the history
In this context, the lookup function returning `undefined` is information - it is a union of Some(data) | None. Void should be used for functions that really return no data.
This has practical implications as in typescript, a property typed `string | undefined` cannot have `string | void` assigned to it.
  • Loading branch information
willstott101 committed Dec 20, 2023
1 parent 8527fd7 commit 3218148
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const mimes: Record<string, string>;
export function lookup(extension: string): string | void;
export function lookup(extension: string): string | undefined;

0 comments on commit 3218148

Please sign in to comment.