-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean Up Assertions + Workspace Tweaks (#71)
- Loading branch information
1 parent
989b634
commit dc5d125
Showing
14 changed files
with
62 additions
and
1,143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
.env | ||
.liminal | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,18 @@ | ||
import type { PromiseOr } from "../../util/mod.ts" | ||
|
||
export interface Assertion<T = any, A extends Array<unknown> = Array<any>> { | ||
export interface Assertion<T = any> { | ||
type: "Assertion" | ||
description: string | ((...args: A) => string) | ||
f?: (value: T, ...args: A) => PromiseOr<void> | ||
args?: A | ||
description: string | ||
f?: (value: T) => PromiseOr<void> | ||
} | ||
|
||
export function Assertion<T>( | ||
description: string, | ||
f?: (value: T) => PromiseOr<void>, | ||
): Assertion<T, []> | ||
export function Assertion<T, A extends unknown[]>( | ||
description: (...args: A) => string, | ||
f?: (value: T, ...args: A) => PromiseOr<void>, | ||
...args: A | ||
): Assertion<T, A> | ||
export function Assertion<T, A extends unknown[]>( | ||
description: (...args: A) => string, | ||
f?: (value: T, ...args: A) => PromiseOr<void>, | ||
): (...args: A) => Assertion<T, A> | ||
export function Assertion<T>( | ||
description: string | ((...args: unknown[]) => string), | ||
f?: (value: T, ...args: unknown[]) => PromiseOr<void>, | ||
...args: unknown[] | ||
): Assertion<T> | ((...args: unknown[]) => Assertion<T>) { | ||
if (typeof description === "string") { | ||
return { | ||
type: "Assertion", | ||
description, | ||
f, | ||
} | ||
} | ||
if (args.length) { | ||
return { | ||
type: "Assertion", | ||
description, | ||
f, | ||
args, | ||
} | ||
} | ||
return (...args) => ({ | ||
): Assertion<T> { | ||
return { | ||
type: "Assertion", | ||
description, | ||
f, | ||
args, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.