Skip to main content

generateSimpleSequentialUnion()

generateSimpleSequentialUnion(varName, branches, ctx, errorMessage?): object

Experimental

Generates a simpler sequential union using inline checks. Each branch is checked in sequence with early return on success.


Parameters​

varName: string​

The variable name to check

branches: UnionBranchMeta[]​

Union branches

ctx: GeneratorContext​

The generator context

errorMessage?: string​

Custom error message


Returns: object​

Generated code and updated context

code: string[]​

ctx: GeneratorContext​


Since​

2.0.0