Skip to content

Commit 6806fa3

Browse files
authored
🤖 Merge PR DefinitelyTyped#73016 [pdfkit] Fixed CellOptions typings by @BamButz
1 parent 4a24ba8 commit 6806fa3

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

types/pdfkit/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ declare namespace PDFKit.Mixins {
439439
data: Array<Array<string | CellOptions>>;
440440
}
441441

442+
interface ExpandedAlign {
443+
x?: "left" | "center" | "right" | "justify";
444+
y?: "top" | "center" | "bottom";
445+
}
446+
442447
interface CellOptions extends CellStyle {
443448
/** The value, will be cast to a string (null and undefined are not rendered but the cell is still outlined) */
444449
text?: string | undefined | null;
@@ -451,7 +456,7 @@ declare namespace PDFKit.Mixins {
451456
/** Font options for the cell */
452457
font?: any;
453458
/** The alignment of the cell text (default {x: 'left', y: 'top'}) */
454-
align?: { x?: "right" | "left"; y?: "top" | "bottom" };
459+
align?: "center" | ExpandedAlign;
455460
/** The text stroke (default 0) */
456461
textStroke?: number | boolean;
457462
/** Sets the text stroke color of the cells text (default black) */

types/pdfkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/pdfkit",
4-
"version": "0.14.9999",
4+
"version": "0.17.9999",
55
"projects": [
66
"http://pdfkit.org"
77
],

types/pdfkit/pdfkit-tests.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,17 @@ doc.text("before")
436436
})
437437
.text("after");
438438

439+
doc.table({
440+
data: [
441+
[
442+
{
443+
align: { x: "center", y: "bottom" },
444+
text: "test",
445+
},
446+
],
447+
],
448+
});
449+
439450
doc.text("Scale", { align: "justify" });
440451

441452
doc.text("Baseline - string literal", { baseline: "alphabetic" });

0 commit comments

Comments
 (0)