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