mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
🤖 Merge PR #46583 minimalistic-assert: use assertion signature by @yoursunny
This commit is contained in:
parent
f0841a3126
commit
3844f3456b
3
types/minimalistic-assert/index.d.ts
vendored
3
types/minimalistic-assert/index.d.ts
vendored
@ -2,8 +2,9 @@
|
||||
// Project: https://github.com/calvinmetcalf/minimalistic-assert
|
||||
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Minimum TypeScript Version: 3.7
|
||||
|
||||
declare function assert(val: any, msg?: string): void;
|
||||
declare function assert(val: any, msg?: string): asserts val;
|
||||
|
||||
declare namespace assert {
|
||||
function equal<T>(l: T, r: T, msg?: string): void;
|
||||
|
||||
@ -8,3 +8,11 @@ assert(0, "error");
|
||||
assert.equal(1, 1);
|
||||
assert.equal(2, 1, "error");
|
||||
assert.equal("ok", "ok");
|
||||
|
||||
() => {
|
||||
const x: number|string = 1;
|
||||
assert(typeof x === "number");
|
||||
|
||||
// $ExpectType number
|
||||
x;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user