Skip to content

procxy / VerifyIsomorphism

Type Alias: VerifyIsomorphism<T, Mode, SH>

ts
type VerifyIsomorphism<T, Mode, SH> = UnwrapProcxy<Procxy<T, Mode, SH>> extends T ? T : never;

Defined in: src/types/isomorphism.ts:180

Compile-time assertion that T round-trips through Procxy<T> without loss.

Type Parameters

Type ParameterDefault typeDescription
T-Original type to verify
Mode extends SerializationMode"json"Serialization mode
SH extends booleanfalseHandle support flag

Remarks

Resolves to T when UnwrapProcxy<Procxy<T, Mode, SH>> extends T (i.e., the isomorphism holds). Resolves to never otherwise — useful in a type _check = VerifyIsomorphism<T> statement to get a compile error when the mapping breaks.

Example

typescript
import type { VerifyIsomorphism } from 'procxy';
import { Calculator } from './calculator.js';

type _check = VerifyIsomorphism<Calculator>; // Calculator (isomorphism holds)

Released under the MIT License.