From e65f6dfddc929e33f683bc634cd1443f68f7786c Mon Sep 17 00:00:00 2001 From: Fleny Date: Sun, 30 Nov 2025 18:57:33 +0100 Subject: [PATCH] Explicit the IsKeyDesired TProps never behavior --- packages/bot/src/desiredProperties.ts | 32 ++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/bot/src/desiredProperties.ts b/packages/bot/src/desiredProperties.ts index aa93bb55e..b519a84f3 100644 --- a/packages/bot/src/desiredProperties.ts +++ b/packages/bot/src/desiredProperties.ts @@ -927,23 +927,25 @@ export type AreDependenciesSatisfied | undefined, TProps> = TKey extends keyof TProps // The key has a desired props? - ? // Yes, is it true? - TProps[TKey] extends true - ? // Yes, this is a key to include - true - : // No, this is a key to exclude - DesiredPropertiesError<`This property is not set as desired in desiredProperties option in createBot(), so you can't use it. More info here: https://discordeno.js.org/desired-props`> - : // No, it is a props with dependencies? - TKey extends keyof TDependencies - ? // Yes, has all of its dependencies satisfied? - AreDependenciesSatisfied extends true[] +export type IsKeyDesired | undefined, TProps> = TProps extends never // If the props are never, all props are allowed + ? true + : TKey extends keyof TProps // The key has a desired props? + ? // Yes, is it true? + TProps[TKey] extends true ? // Yes, this is a key to include true - : // No, this is a key to not include - DesiredPropertiesError<`This property depends on the following properties: ${JoinTuple[TKey], ', '>}. Not all of these props are set as desired in desiredProperties option in createBot(), so you can't use it. More info here: https://discordeno.js.org/desired-props`> - : // No, we include it but it does not have neither props nor dependencies - true + : // No, this is a key to exclude + DesiredPropertiesError<`This property is not set as desired in desiredProperties option in createBot(), so you can't use it. More info here: https://discordeno.js.org/desired-props`> + : // No, it is a props with dependencies? + TKey extends keyof TDependencies + ? // Yes, has all of its dependencies satisfied? + AreDependenciesSatisfied extends true[] + ? // Yes, this is a key to include + true + : // No, this is a key to not include + DesiredPropertiesError<`This property depends on the following properties: ${JoinTuple[TKey], ', '>}. Not all of these props are set as desired in desiredProperties option in createBot(), so you can't use it. More info here: https://discordeno.js.org/desired-props`> + : // No, we include it but it does not have neither props nor dependencies + true /** The behavior it should be used when resolving an undesired property */ export enum DesiredPropertiesBehavior {