From 21b90fac5df991b0e76dad1a23c26146838c0c1a Mon Sep 17 00:00:00 2001 From: Nic Wilson Date: Fri, 8 Nov 2019 14:42:56 -0600 Subject: [PATCH 1/2] 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 --- src/typeform-types.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/typeform-types.ts b/src/typeform-types.ts index 276a9f8..a446c90 100644 --- a/src/typeform-types.ts +++ b/src/typeform-types.ts @@ -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. @@ -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: AndOrOperator[] | Condition[] + } /** * Generic document. */ From b475ba8d978de1248744c43c8fcf38ab838b8a55 Mon Sep 17 00:00:00 2001 From: Nic Wilson Date: Tue, 19 Nov 2019 11:12:21 -0600 Subject: [PATCH 2/2] fix(types): Use proper Array union type syntax --- src/typeform-types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typeform-types.ts b/src/typeform-types.ts index a446c90..92c0f38 100644 --- a/src/typeform-types.ts +++ b/src/typeform-types.ts @@ -209,7 +209,7 @@ export namespace Typeform { /** * Object that defines the field type and value to evaluate with the operator. */ - vars: AndOrOperator[] | Condition[] + vars: Array } /** * Generic document.