Skip to content

[POC] Add PrintOptions destination to Print API#3915

Draft
aaronschubert0 wants to merge 1 commit into2026-04-rcfrom
add-print-options-destination
Draft

[POC] Add PrintOptions destination to Print API#3915
aaronschubert0 wants to merge 1 commit into2026-04-rcfrom
add-print-options-destination

Conversation

@aaronschubert0
Copy link

Summary

  • Add PrintDestination type ('system' | 'receipt') and PrintOptions interface to the Print API
  • Update PrintApiContent.print() method signature to accept an optional PrintOptions second parameter: print(src: string, options?: PrintOptions): Promise<void>
  • Export new types from the POS surface barrel file (api.ts)
  • Update print-api.doc.ts to include PrintOptions and PrintDestination in the generated documentation definitions

Why

Extensions currently cannot print to the physical receipt printer connected to a POS device. This adds a destination option to the existing Print API so extensions can choose between the system print dialog (default) and the receipt printer.

The design follows the Web API alignment pattern (Window.print() extended with an options-bag, like fetch(url, options)), making the change backward-compatible — the second parameter is optional and defaults to 'system' behavior.

Type Changes

/** The target destination for printing. */
export type PrintDestination = 'system' | 'receipt';

export interface PrintOptions {
  /** @defaultValue 'system' */
  destination?: PrintDestination;
}

export interface PrintApiContent {
  print(src: string, options?: PrintOptions): Promise<void>;
}

Test plan

  • TypeScript compiles cleanly (tsc --project packages/ui-extensions/tsconfig.json passes)
  • Verify generated docs include PrintOptions and PrintDestination types
  • Backward-compatible: existing print(src) calls without options continue to work

🤖 Generated with Claude Code

Add PrintDestination type and PrintOptions interface to the Print API,
enabling extensions to specify a print destination ('system' or 'receipt').
This allows printing to the physical receipt printer on POS devices.

- Add PrintDestination type: 'system' | 'receipt'
- Add PrintOptions interface with optional destination field
- Update PrintApiContent.print() to accept optional PrintOptions parameter
- Export new types from api.ts barrel file
- Update print-api.doc.ts with new type definitions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aaronschubert0 aaronschubert0 changed the title Add PrintOptions destination to Print API [POC] Add PrintOptions destination to Print API Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments