import { describe, it } from "vitest"; import { AssertFalse, Expect, Test, } from "inferred-types/types"; import { IsVariant } from "~"; import { AssertTrue } from "inferred-types"; describe("IsVariant", () => { it("wide tokens", () => { type T1 = IsVariant; type T2 = IsVariant; type T3 = IsVariant; type cases = [ Expect>, Expect>, Expect>, ]; }); it("literal tokens", () => { type F1 = IsVariant<`"foo"`>; type F1b = IsVariant<"foo">; type F2 = IsVariant<`42`>; type F3 = IsVariant<`null`>; type F4 = IsVariant<42>; type cases = [ Expect>, Expect>, Expect>, Expect>, Expect>, ]; }); it("union tokens", () => { type T1 = IsVariant<`"foo" | "bar"`>; type T2 = IsVariant<`"foo" | 42`>; type T3 = IsVariant<42 | undefined>; type cases = [ Expect>, Expect>, Expect>, ]; }); it("non-token literal", () => { type F1 = IsVariant<"foo">; type F2 = IsVariant<42>; type cases = [ Expect>, Expect>, ]; }); });