diff --git a/.changeset/proud-pandas-draw.md b/.changeset/proud-pandas-draw.md new file mode 100644 index 0000000..373e9b1 --- /dev/null +++ b/.changeset/proud-pandas-draw.md @@ -0,0 +1,5 @@ +--- +"any-ts": patch +--- + +fix: account for contravariance in index signature of `any.dict` diff --git a/src/any/any.ts b/src/any/any.ts index 4d11073..c72a053 100644 --- a/src/any/any.ts +++ b/src/any/any.ts @@ -107,7 +107,7 @@ declare namespace any { export type four = readonly [_1: first, _2: second, _3: third, _4: fourth] export type triple = type export type ternary = type - export type record = globalThis.Record> = type + export type record = globalThis.Record> = type export type predicate = type export type asserts = never | some.asserts diff --git a/src/lens/tree.ts b/src/lens/tree.ts index 95adb46..2c8f058 100644 --- a/src/lens/tree.ts +++ b/src/lens/tree.ts @@ -147,7 +147,7 @@ export namespace Tree { = mut>; const isKeyable = (u: unknown): u is any.index => ["number", "string", "symbol"].includes(typeof u) - const isObject = (u: unknown): u is any.dict => typeof u === "object" && u !== null + const isObject = (u: unknown): u is any.record => typeof u === "object" && u !== null function has(k: k): any.typeguard> function has(k: k, guard: any.guard): any.typeguard