From 2212c3ef08c63cd54ef19333200c63da9e7d895f Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 6 Aug 2024 17:32:28 +0200 Subject: [PATCH] frontend-plugin-api: clean up output verification Signed-off-by: Patrik Oldsberg --- .../src/wiring/createExtension.ts | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/packages/frontend-plugin-api/src/wiring/createExtension.ts b/packages/frontend-plugin-api/src/wiring/createExtension.ts index 2c82c44ee1..2a29fe1ab4 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtension.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtension.ts @@ -158,9 +158,7 @@ export interface LegacyCreateExtensionOptions< /** @ignore */ export type VerifyExtensionFactoryOutput< UDeclaredOutput extends AnyExtensionDataRef, - UFactoryOutput extends - | ExtensionDataValue - | ExtensionDataContainer, + UFactoryOutput extends ExtensionDataValue, > = ( UDeclaredOutput extends any ? UDeclaredOutput['config']['optional'] extends true @@ -168,29 +166,21 @@ export type VerifyExtensionFactoryOutput< : UDeclaredOutput['id'] : never ) extends infer IRequiredOutputIds - ? ( - UFactoryOutput extends ExtensionDataValue - ? UFactoryOutput['id'] - : UFactoryOutput extends ExtensionDataContainer - ? IDataRefs['id'] - : never - ) extends infer IFactoryOutputIds - ? [IRequiredOutputIds] extends [IFactoryOutputIds] - ? [IFactoryOutputIds] extends [UDeclaredOutput['id']] - ? {} - : { - 'Error: The extension factory has undeclared output(s)': Exclude< - IFactoryOutputIds, - UDeclaredOutput['id'] - >; - } + ? [IRequiredOutputIds] extends [UFactoryOutput['id']] + ? [UFactoryOutput['id']] extends [UDeclaredOutput['id']] + ? {} : { - 'Error: The extension factory is missing the following output(s)': Exclude< - IRequiredOutputIds, - IFactoryOutputIds + 'Error: The extension factory has undeclared output(s)': Exclude< + UFactoryOutput['id'], + UDeclaredOutput['id'] >; } - : never + : { + 'Error: The extension factory is missing the following output(s)': Exclude< + IRequiredOutputIds, + UFactoryOutput['id'] + >; + } : never; /** @public */