From 59cb8646ab774cd9e3cd7640538335adc36e00fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Wed, 21 Feb 2024 01:12:09 +0100 Subject: [PATCH] BuildTraitExpression refactoring --- src/TraitExpressionBuilder.ts | 40 +++++++++++++---------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/TraitExpressionBuilder.ts b/src/TraitExpressionBuilder.ts index 4e222ee..89b01ec 100644 --- a/src/TraitExpressionBuilder.ts +++ b/src/TraitExpressionBuilder.ts @@ -16,35 +16,25 @@ type SpreadSupertraits = ( ) -type InstanceExtendable< - Superclass extends AbstractClass, - Traits extends Trait[], -> = ( - Extendable<[ - InstanceType, - ...TraitTuple.MapInstance, - ]> -) - -type StaticMembersExtendable< - Superclass extends AbstractClass, - Traits extends Trait[], -> = ( - Extendable<[ - StaticMembers, - ...TraitTuple.MapStaticMembers, - ]> -) - type BuildTraitExpression< Superclass extends AbstractClass, Traits extends Trait[], > = ( - InstanceExtendable extends false - ? "Type conflict on the instance side." - : StaticMembersExtendable extends false - ? "Type conflict on the static side." - : TraitExpression + Extendable> extends false + ? "Type conflict between the traits abstract definitions." + : Extendable> extends false + ? "Type conflict between the traits static abstract definitions." + : Extendable<[ + InstanceType, + ...TraitTuple.MapImplInstance, + ]> extends false + ? "Type conflict between the traits implementation instance and/or the superclass instance." + : Extendable<[ + StaticMembers, + ...TraitTuple.MapImplStaticMembers, + ]> extends false + ? "Type conflict between the traits implementation static members and/or the superclass static members." + : TraitExpression )