import type { TypeEqual, TypeOf } from "ts-expect"; import { expectType } from "ts-expect"; import { it } from "vitest"; import type { ConstructorOptions, UnusedCesiumProps, PickCesiumProps, Merge, UnionMerge, ArrayKeys, } from "./types"; class Test { constructor({ hoge }: { hoge: string }) { this.hoge = hoge; } hoge: string | null; readonly foo = true; bar() { return 1; } } // Test class for optional properties (similar to Cesium 1.135.0 changes) class TestWithOptional { requiredProp = "test"; optionalProp: number | undefined; readonly readOnlyProp = true; method() { return 1; } } // Test class for private properties (starting with underscore) class TestWithPrivate { publicProp = "public"; _privateProp = 42; readonly readOnlyProp = true; method() { return 1; } } type TestOptions = { hoge?: string | number; }; const keys = ["hoge", "foo", "bar"] as const; const readOnlyKeys: string[] = ["hoge", "foo", "bar"]; // Suppress unused vars - these are used for type testing void keys; void readOnlyKeys; expectType, "hoge" | "foo">>( true, ); expectType< TypeOf< Merge<{ a: string; b?: string }, { b: number; c?: boolean }>, { a: string; b: number; c?: boolean } > >(true); expectType< TypeOf< UnionMerge<{ a: string; b?: string }, { b: number; c?: boolean }>, { a: string; b: string | number | undefined; c?: boolean } > >(true); expectType, { hoge: string }>>(true); expectType, never>>(true); expectType, "hoge">>(true); expectType, "hoge" | "foo">>(true); expectType, "foo">>(true); expectType, never>>(true); expectType, { hoge?: string | null }>>(true); expectType, { hoge?: string | null }>>(true); expectType, { hoge?: string | number }>>(true); expectType, "hoge">, { hoge?: string | number }>>( true, ); expectType< TypeOf, "hoge">, { hoge?: string | number | null }> >(true); // Test UnusedCesiumProps with optional properties expectType< TypeEqual, never> >(true); expectType< TypeEqual, "optionalProp"> >(true); // Test UnusedCesiumProps with private properties (should be automatically filtered) expectType< TypeEqual, never> >(true); expectType< TypeEqual, "publicProp"> >(true); // _privateProp should NOT appear as unused since it's filtered by PrivateKeys it("should be compiled", () => {});