From d957b780273c149b2bd4d37051a4b69017ccb773 Mon Sep 17 00:00:00 2001 From: unional Date: Sun, 22 Oct 2023 19:26:28 +0000 Subject: [PATCH] fix: remove empty object check This is likely to workaround a bug in TS whice does not apply any more --- type-plus/ts/predicates/CanAssign.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/type-plus/ts/predicates/CanAssign.ts b/type-plus/ts/predicates/CanAssign.ts index 250c8e07c8..1073061833 100644 --- a/type-plus/ts/predicates/CanAssign.ts +++ b/type-plus/ts/predicates/CanAssign.ts @@ -24,14 +24,10 @@ import type { IsEmptyObject } from './IsEmptyObject.js' * If you want to make sure all branches are assignable, * use `StrictCanAssign`. */ -export type CanAssign = IsEmptyObject extends true - ? Record extends B - ? Then - : Else - : boolean extends A +export type CanAssign = boolean extends A ? boolean extends B - ? Then - : Else + ? Then + : Else : A extends B ? Then : Else @@ -49,12 +45,12 @@ export type CanAssign = IsEmptyObject extend */ export type StrictCanAssign = IsEmptyObject extends true ? Record extends B - ? Then - : Else + ? Then + : Else : boolean extends A ? boolean extends B - ? Then - : Else + ? Then + : Else : [A] extends [B] ? Then : Else