Skip to content

Commit

Permalink
Fix more slow types pointed out by JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
jviide committed Dec 1, 2024
1 parent ddc1225 commit 4a1e635
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-mice-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@badrap/valita": patch
---

Fix more slow types pointed out by JSR
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1790,13 +1790,17 @@ function singleton<Output>(
* Create a validator that matches any value,
* analogous to the TypeScript type `unknown`.
*/
const unknown = singleton<unknown>("unknown", TAG_UNKNOWN, () => undefined);
const unknown: () => Type = singleton<unknown>(
"unknown",
TAG_UNKNOWN,
() => undefined,
);

/**
* Create a validator that never matches any value,
* analogous to the TypeScript type `never`.
*/
const never = singleton<never>(
const never: () => Type<never> = singleton<never>(
"never",
TAG_NEVER,
() => ISSUE_EXPECTED_NOTHING,
Expand Down

0 comments on commit 4a1e635

Please sign in to comment.