Popular
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
import type { NonPostableEvtLike, StatefulEvt, StatefulReadonlyEvtLike } from "../../lib/index.ts";import { Evt } from "../../lib/index.ts";import { assert } from "https://deno.land/x/tsafe@v1.4.1/mod.ts";import type { Equals } from "https://deno.land/x/tsafe@v1.4.1/mod.ts";import { Reflect } from "https://deno.land/x/tsafe@v1.4.1/Reflect.ts";
type T = { _brand: "T";};
{
const got = Evt.create();
type Expected = Evt<void>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<T>();
type Expected = Evt<T>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<T | undefined>();
type Expected = Evt<T | undefined>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<T | undefined>(Reflect<T>());
type Expected = StatefulEvt<T | undefined>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create(Reflect<T>());
type Expected = StatefulEvt<T>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create(Reflect<T | undefined>());
type Expected = StatefulEvt<T | undefined>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<NonPostableEvtLike<T> | undefined>();
type Expected = Evt<T>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<NonPostableEvtLike<T>>();
type Expected = Evt<T>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<NonPostableEvtLike<T | undefined> | undefined>();
type Expected = Evt<T | undefined>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<StatefulReadonlyEvtLike<T> | undefined>(Reflect<T>());
type Expected = StatefulEvt<T>;
assert<Equals<typeof got, Expected>>();
}
{
const got = Evt.create<StatefulReadonlyEvtLike<T | undefined> | undefined>(Reflect<T>())
type Expected = StatefulEvt<T | undefined>;
assert<Equals<typeof got, Expected>>();
}