From 802e6354bd6be80359623d92602b63597c8f6fc3 Mon Sep 17 00:00:00 2001 From: Ishaan Kapur <64529428+ishaanlabs-gg@users.noreply.github.com> Date: Wed, 1 Jul 2026 04:06:52 +0530 Subject: [PATCH] docs: name print options type --- plugins/plugin-print/src/index.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/plugin-print/src/index.ts b/plugins/plugin-print/src/index.ts index 6355b171..07f64ee0 100644 --- a/plugins/plugin-print/src/index.ts +++ b/plugins/plugin-print/src/index.ts @@ -27,7 +27,7 @@ const PrintOptionsSchema = z.object({ maxWidth: z.number().optional(), /** the boundary height to draw in */ maxHeight: z.number().optional(), - /** a callback for when complete that ahs the end co-ordinates of the text */ + /** a callback for when complete that has the end co-ordinates of the text */ cb: z .function(z.tuple([z.object({ x: z.number(), y: z.number() })])) .optional(), @@ -35,6 +35,14 @@ const PrintOptionsSchema = z.object({ export type PrintOptions = z.infer; +/** + * Options for {@link print}. + */ +export type PrintOptionsWithFont = PrintOptions & { + /** the BMFont instance */ + font: BmFont; +}; + function xOffsetBasedOnAlignment( font: BmFont, line: string, @@ -133,16 +141,8 @@ export const methods = { * image.print({ font, x: 10, y: 10, text: "Hello world!" }); * ``` */ - print( - image: I, - { - font, - ...options - }: PrintOptions & { - /** the BMFont instance */ - font: BmFont; - } - ) { + print(image: I, options: PrintOptionsWithFont) { + const { font, ...printOptions } = options; let { // eslint-disable-next-line prefer-const x, @@ -154,7 +154,7 @@ export const methods = { maxHeight = Infinity, // eslint-disable-next-line prefer-const cb = () => {}, - } = PrintOptionsSchema.parse(options); + } = PrintOptionsSchema.parse(printOptions); let alignmentX: HorizontalAlign; let alignmentY: VerticalAlign;