Skip to main content

InferType

@ts-rust/std


@ts-rust/std / Types / InferType

Type Alias: InferType<Left, Right>

type InferType<Left, Right> = unknown extends Left ? Right : Left | Right;

Defined in: packages/std/src/types.ts:200

Merges two type parameters, treating unknown as an unbound slot.

When Left is unknown (e.g. the open side of an unannotated factory), returns Right alone. Otherwise returns Left | Right. Used when chaining result operations so a concrete type from a callback is not swallowed by unknown | T collapsing to unknown.

Type Parameters

Type Parameter

Left

Right