@blocksuite/global
Advanced tools
Comparing version 0.5.0-20230302104138-788dae4 to 0.5.0-20230302142916-8e090d3
@@ -22,3 +22,3 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
type Allowed = void | null | undefined | boolean | number | string | unknown[] | object; | ||
export declare function assertEquals<T extends Allowed, U extends T>(val: T, expected: U): asserts val is U; | ||
export declare function assertEquals<T extends Allowed, U extends T>(val: T, expected: U, message?: string): asserts val is U; | ||
export declare function isEqual<T extends Allowed, U extends T>(val: T, expected: U): boolean; | ||
@@ -25,0 +25,0 @@ export declare function sleep(ms: number): Promise<void>; |
@@ -38,5 +38,5 @@ export { DisposableGroup, flattenDisposable } from './utils/disposable.js'; | ||
export const isNonTextBlock = (model) => matchFlavours(model, nonTextBlock); | ||
export function assertEquals(val, expected) { | ||
export function assertEquals(val, expected, message = 'val is not same as expected') { | ||
if (!isEqual(val, expected)) { | ||
throw new Error('val is not same as expected'); | ||
throw new Error(message); | ||
} | ||
@@ -43,0 +43,0 @@ } |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.5.0-20230302104138-788dae4", | ||
"version": "0.5.0-20230302142916-8e090d3", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -77,6 +77,7 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
val: T, | ||
expected: U | ||
expected: U, | ||
message = 'val is not same as expected' | ||
): asserts val is U { | ||
if (!isEqual(val, expected)) { | ||
throw new Error('val is not same as expected'); | ||
throw new Error(message); | ||
} | ||
@@ -83,0 +84,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
409887
4400