Skip to content

Commit

Permalink
fix(NOJIRA-123): fix Action.condition type (#50)
Browse files Browse the repository at this point in the history
* fix(types): fix Condition.op, Condition.vars type

The Create API allows for the logical operators 'and' and 'or' to used as the operator for a condition.

https://developer.typeform.com/create/logic-jumps/#best-practices-for-logic-jumps

* fix(types): Use proper Array union type syntax
  • Loading branch information
nicolaslwilson authored Oct 3, 2023
1 parent 3348493 commit 6652cb5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/typeform-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export namespace Typeform {
* Conditions for executing the Logic Jump. Conditions answer the question, "Under what circumstances?"
* The condition object is the IF statement in your Logic Jump.
*/
condition?: Condition
condition?: Condition | AndOrOperator
}
/**
* Properties that further specify how the Logic Jump will behave.
Expand Down Expand Up @@ -198,6 +198,19 @@ export namespace Typeform {
value?: any
}[]
}
/**
* Conditions for a logic jump can be combined using the `and` and `or` operators
*/
export interface AndOrOperator {
/**
* Operator for the condition.
*/
op?: 'and' | 'or'
/**
* Object that defines the field type and value to evaluate with the operator.
*/
vars: Array<AndOrOperator | Condition>
}
/**
* Generic document.
*/
Expand Down

0 comments on commit 6652cb5

Please sign in to comment.