From 25392cab0051b6840cfdb17175719b3b7bc22365 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 12 Apr 2026 19:17:39 +0200 Subject: [PATCH] Use StandardSchemaV1.InferOutput/InferInput utility types Replace raw NonNullable['output'] access with the canonical StandardSchemaV1.InferOutput and InferInput utility types for improved readability. Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .../frontend-plugin-api/report-alpha.api.md | 36 ++++----- packages/frontend-plugin-api/report.api.md | 78 +++++++++---------- .../src/wiring/createExtension.ts | 36 ++++----- .../src/wiring/createExtensionBlueprint.ts | 42 +++++----- 4 files changed, 96 insertions(+), 96 deletions(-) diff --git a/packages/frontend-plugin-api/report-alpha.api.md b/packages/frontend-plugin-api/report-alpha.api.md index 61cf25fb21..9531ec82c9 100644 --- a/packages/frontend-plugin-api/report-alpha.api.md +++ b/packages/frontend-plugin-api/report-alpha.api.md @@ -211,9 +211,9 @@ export interface ExtensionBlueprint< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -227,16 +227,16 @@ export interface ExtensionBlueprint< }): OverridableExtensionDefinition<{ config: Expand< { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; } & T['config'] >; configInput: Expand< { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; } & T['configInput'] >; output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; @@ -618,9 +618,9 @@ export interface OverridableExtensionDefinition< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -647,14 +647,14 @@ export interface OverridableExtensionDefinition< output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; inputs: T['inputs'] & TExtraInputs; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; configInput: T['configInput'] & { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; }; }>; // @deprecated (undocumented) diff --git a/packages/frontend-plugin-api/report.api.md b/packages/frontend-plugin-api/report.api.md index 4b54486fd9..1d061be9ae 100644 --- a/packages/frontend-plugin-api/report.api.md +++ b/packages/frontend-plugin-api/report.api.md @@ -486,14 +486,14 @@ export function createExtension< }, ): OverridableExtensionDefinition<{ config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; configInput: { - [key in keyof TNewConfigSchema]?: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput< + TNewConfigSchema[key] + >; }; output: UOutput extends ExtensionDataRef< infer IData, @@ -602,9 +602,9 @@ export function createExtensionBlueprint< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; inputs: Expand>; }, @@ -623,14 +623,14 @@ export function createExtensionBlueprint< : never; inputs: string extends keyof TInputs ? {} : TInputs; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; configInput: { - [key in keyof TNewConfigSchema]?: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput< + TNewConfigSchema[key] + >; }; dataRefs: TDataRefs; }>; @@ -756,9 +756,9 @@ export type CreateExtensionBlueprintOptions< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; } & { [key in keyof TConfigSchema]: z.infer< ReturnType<((...args: any[]) => any) & TConfigSchema[key]> @@ -846,9 +846,9 @@ export type CreateExtensionOptions< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; } & { [key in keyof TConfigSchema]: z.infer< ReturnType<((...args: any[]) => any) & TConfigSchema[key]> @@ -1264,9 +1264,9 @@ export interface ExtensionBlueprint< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -1280,16 +1280,16 @@ export interface ExtensionBlueprint< }): OverridableExtensionDefinition<{ config: Expand< { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; } & T['config'] >; configInput: Expand< { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; } & T['configInput'] >; output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; @@ -2001,9 +2001,9 @@ export interface OverridableExtensionDefinition< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -2030,14 +2030,14 @@ export interface OverridableExtensionDefinition< output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; inputs: T['inputs'] & TExtraInputs; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; configInput: T['configInput'] & { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; }; }>; // @deprecated (undocumented) diff --git a/packages/frontend-plugin-api/src/wiring/createExtension.ts b/packages/frontend-plugin-api/src/wiring/createExtension.ts index a89d138e2f..fd6015c016 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtension.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtension.ts @@ -198,9 +198,9 @@ export type CreateExtensionOptions< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; } & { [key in keyof TConfigSchema]: z.infer< ReturnType<((...args: any[]) => any) & TConfigSchema[key]> @@ -312,9 +312,9 @@ export interface OverridableExtensionDefinition< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -341,14 +341,14 @@ export interface OverridableExtensionDefinition< output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; inputs: T['inputs'] & TExtraInputs; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; configInput: T['configInput'] & { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; }; }>; @@ -539,14 +539,14 @@ export function createExtension< > & { config?: never }, ): OverridableExtensionDefinition<{ config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; configInput: { - [key in keyof TNewConfigSchema]?: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput< + TNewConfigSchema[key] + >; }; output: UOutput extends ExtensionDataRef< infer IData, diff --git a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts index ec74c7801e..aba81d64f3 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts @@ -181,9 +181,9 @@ export type CreateExtensionBlueprintOptions< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; } & { [key in keyof TConfigSchema]: z.infer< ReturnType<((...args: any[]) => any) & TConfigSchema[key]> @@ -310,9 +310,9 @@ export interface ExtensionBlueprint< node: AppNode; apis: ApiHolder; config: T['config'] & { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; }; inputs: Expand>; }, @@ -326,16 +326,16 @@ export interface ExtensionBlueprint< }): OverridableExtensionDefinition<{ config: Expand< { - [key in keyof TNewExtensionConfigSchema]: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput< + TNewExtensionConfigSchema[key] + >; } & T['config'] >; configInput: Expand< { - [key in keyof TNewExtensionConfigSchema]?: NonNullable< - TNewExtensionConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput< + TNewExtensionConfigSchema[key] + >; } & T['configInput'] >; output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput; @@ -594,9 +594,9 @@ export function createExtensionBlueprint< node: AppNode; apis: ApiHolder; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; inputs: Expand>; }, @@ -615,14 +615,14 @@ export function createExtensionBlueprint< : never; inputs: string extends keyof TInputs ? {} : TInputs; config: { - [key in keyof TNewConfigSchema]: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['output']; + [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput< + TNewConfigSchema[key] + >; }; configInput: { - [key in keyof TNewConfigSchema]?: NonNullable< - TNewConfigSchema[key]['~standard']['types'] - >['input']; + [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput< + TNewConfigSchema[key] + >; }; dataRefs: TDataRefs; }>;