From 6e911a52a28cf18b0faae5f7a8db9f584ab03af9 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 20 May 2024 06:04:29 +0000 Subject: [PATCH] chore(release): 6.0.1 [skip ci] ## [6.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v6.0.0...v6.0.1) (2024-05-20) ### Bug Fixes * type when merging index signatures ([5e8b9b6](https://github.com/RebeccaStevens/deepmerge-ts/commit/5e8b9b668a13ef51da10a5321d4698d01d872013)), closes [#459](https://github.com/RebeccaStevens/deepmerge-ts/issues/459) --- CHANGELOG.md | 7 +++++++ dist/deno/types/defaults.ts | 3 ++- dist/deno/types/utils.ts | 8 ++++++++ dist/node/index.d.cts | 10 +++++++++- dist/node/index.d.mts | 10 +++++++++- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf7fe26..7abf1cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. Dates are displayed in UTC. +## [6.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v6.0.0...v6.0.1) (2024-05-20) + + +### Bug Fixes + +* type when merging index signatures ([5e8b9b6](https://github.com/RebeccaStevens/deepmerge-ts/commit/5e8b9b668a13ef51da10a5321d4698d01d872013)), closes [#459](https://github.com/RebeccaStevens/deepmerge-ts/issues/459) + # [6.0.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v5.1.0...v6.0.0) (2024-05-19) diff --git a/dist/deno/types/defaults.ts b/dist/deno/types/defaults.ts index 53b565af..303020e1 100644 --- a/dist/deno/types/defaults.ts +++ b/dist/deno/types/defaults.ts @@ -7,6 +7,7 @@ import { import { type FilterOutNever, type FlattenTuples, + type KeyIsOptional, type SimplifyObject, type TransposeTuple, type TupleToIntersection, @@ -75,7 +76,7 @@ type RecordToRecordMeta> = { [K in keyof T]-?: { key: K; value: Required[K]; - optional: {} extends Pick ? true : false; + optional: KeyIsOptional; }; }; diff --git a/dist/deno/types/utils.ts b/dist/deno/types/utils.ts index dd9e8bed..83a049da 100644 --- a/dist/deno/types/utils.ts +++ b/dist/deno/types/utils.ts @@ -55,6 +55,14 @@ export type Or = T1 extends true */ export type Not = T extends true ? false : true; +/** + * Check if a key is optional in the given object. + */ +export type KeyIsOptional< + K extends PropertyKey, + O extends { [Key in K]?: unknown }, +> = O extends { [Key in K]: unknown } ? false : true; + /** * Returns whether or not all the given types are never. */ diff --git a/dist/node/index.d.cts b/dist/node/index.d.cts index 65b554a8..7ed53f9a 100644 --- a/dist/node/index.d.cts +++ b/dist/node/index.d.cts @@ -55,6 +55,14 @@ type Or = T1 extends true ? true : T2; * Not operator for types. */ type Not = T extends true ? false : true; +/** + * Check if a key is optional in the given object. + */ +type KeyIsOptional = O extends { + [Key in K]: unknown; +} ? false : true; /** * Returns whether or not the given type a record. */ @@ -380,7 +388,7 @@ type RecordToRecordMeta> = { [K in keyof T]-?: { key: K; value: Required[K]; - optional: {} extends Pick ? true : false; + optional: KeyIsOptional; }; }; /** diff --git a/dist/node/index.d.mts b/dist/node/index.d.mts index 65b554a8..7ed53f9a 100644 --- a/dist/node/index.d.mts +++ b/dist/node/index.d.mts @@ -55,6 +55,14 @@ type Or = T1 extends true ? true : T2; * Not operator for types. */ type Not = T extends true ? false : true; +/** + * Check if a key is optional in the given object. + */ +type KeyIsOptional = O extends { + [Key in K]: unknown; +} ? false : true; /** * Returns whether or not the given type a record. */ @@ -380,7 +388,7 @@ type RecordToRecordMeta> = { [K in keyof T]-?: { key: K; value: Required[K]; - optional: {} extends Pick ? true : false; + optional: KeyIsOptional; }; }; /**