New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: tsify web-contents #24325
chore: tsify web-contents #24325
Conversation
@@ -67,8 +75,8 @@ const PDFPageSizes = { | |||
// Default printing setting | |||
const defaultPrintingSetting = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of all the as
casts below we should type this as Electron.WhateverThePrintingSettingsInterfaceIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there exists any type in electron.d.ts that matches this.
$ rg '\bpageRange\b'
lib/browser/api/web-contents.ts
78: pageRange: [] as {from: number, to: number}[],
279: printSettings.pageRange = [{
$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nornagon That's because according to the docs it's pageRanges
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also true of several other members of this struct:
$ rg '\bshouldPrintBackgrounds\b'
lib/browser/api/web-contents.ts
84: shouldPrintBackgrounds: false,
258: printSettings.shouldPrintBackgrounds = options.printBackground;
$ rg '\bheaderFooterEnabled\b'
lib/browser/api/web-contents.ts
81: headerFooterEnabled: false,
287: printSettings.headerFooterEnabled = true;
$ rg '\bgenerateDraftData\b'
lib/browser/api/web-contents.ts
96: generateDraftData: true,
$
I don't think the struct you're thinking of is the same as this struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the type of this struct is related to these
@@ -360,14 +357,14 @@ WebContents.prototype.print = function (options = {}, callback) { | |||
throw new Error('height and width properties are required for pageSize'); | |||
} | |||
// Dimensions in Microns - 1 meter = 10^6 microns | |||
options.mediaSize = { | |||
(options as any).mediaSize = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These any
casts shouldn't be needed if the original options
object is typed correctly
No Release Notes |
Also, deleted
WebContents.sendToAll
which isn't documented or used anywhere.Notes: none