Skip to content

Commit

Permalink
engine (fix): correct types for chunked/monolithic submission result
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
eyelidlessness committed Jan 24, 2025
1 parent 0700362 commit dac0d0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-needles-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@getodk/xforms-engine': patch
---

Fix: correct types for chunked/monolithic submission result
14 changes: 9 additions & 5 deletions packages/xforms-engine/src/client/RootNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<ChunkedType extends SubmissionChunkedType>(
options?: SubmissionOptions<ChunkedType>
): Promise<SubmissionResult<ChunkedType>>;
prepareSubmission(): Promise<MonolithicSubmissionResult>;
prepareSubmission(options: SubmissionOptions<'monolithic'>): Promise<MonolithicSubmissionResult>;
prepareSubmission(options: SubmissionOptions<'chunked'>): Promise<ChunkedSubmissionResult>;
}

0 comments on commit dac0d0b

Please sign in to comment.