From dac0d0ba73e86f1eb7c4068ac525cf4a71c3314c Mon Sep 17 00:00:00 2001 From: eyelidlessness Date: Fri, 24 Jan 2025 10:21:06 -0800 Subject: [PATCH] engine (fix): correct types for chunked/monolithic submission result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m not really sure I understand why the simpler signature was wrong! It’s also possible the inference behavior is different in Vue (where I observed wrong-ness). --- .changeset/strange-needles-compare.md | 5 +++++ packages/xforms-engine/src/client/RootNode.ts | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .changeset/strange-needles-compare.md diff --git a/.changeset/strange-needles-compare.md b/.changeset/strange-needles-compare.md new file mode 100644 index 000000000..6328fd49f --- /dev/null +++ b/.changeset/strange-needles-compare.md @@ -0,0 +1,5 @@ +--- +'@getodk/xforms-engine': patch +--- + +Fix: correct types for chunked/monolithic submission result diff --git a/packages/xforms-engine/src/client/RootNode.ts b/packages/xforms-engine/src/client/RootNode.ts index 5e3dcffca..a4e60d980 100644 --- a/packages/xforms-engine/src/client/RootNode.ts +++ b/packages/xforms-engine/src/client/RootNode.ts @@ -3,8 +3,12 @@ import type { RootDefinition } from '../parse/model/RootDefinition.ts'; import type { BaseNode, BaseNodeState } from './BaseNode.ts'; import type { ActiveLanguage, FormLanguage, FormLanguages } from './FormLanguage.ts'; import type { GeneralChildNode } from './hierarchy.ts'; -import type { SubmissionChunkedType, SubmissionOptions } from './submission/SubmissionOptions.ts'; -import type { SubmissionResult } from './submission/SubmissionResult.ts'; +import type { SubmissionOptions } from './submission/SubmissionOptions.ts'; +import type { + ChunkedSubmissionResult, + MonolithicSubmissionResult, + SubmissionResult, +} from './submission/SubmissionResult.ts'; import type { AncestorNodeValidationState } from './validation.ts'; export interface RootNodeState extends BaseNodeState { @@ -84,7 +88,7 @@ export interface RootNode extends BaseNode { * A client may specify {@link SubmissionOptions<'chunked'>}, in which case a * {@link SubmissionResult<'chunked'>} will be produced, with form attachments */ - prepareSubmission( - options?: SubmissionOptions - ): Promise>; + prepareSubmission(): Promise; + prepareSubmission(options: SubmissionOptions<'monolithic'>): Promise; + prepareSubmission(options: SubmissionOptions<'chunked'>): Promise; }