build: update to latest TypeScript (#38763)

This commit is contained in:
Shelley Vohr 2023-06-14 20:06:46 +02:00 committed by GitHub
parent 10852b3fd5
commit f7c0a29d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 11 deletions

View file

@ -8,7 +8,7 @@ import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
interface GuestInstance {
elementInstanceId: number;
visibilityState?: VisibilityState;
visibilityState?: DocumentVisibilityState;
embedder: Electron.WebContents;
guest: Electron.WebContents;
}
@ -229,7 +229,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
watchedEmbedders.add(embedder);
// Forward embedder window visibility change events to guest
const onVisibilityChange = function (visibilityState: VisibilityState) {
const onVisibilityChange = function (visibilityState: DocumentVisibilityState) {
for (const guestInstance of guestInstances.values()) {
guestInstance.visibilityState = visibilityState;
if (guestInstance.embedder === embedder) {

View file

@ -110,7 +110,7 @@ export function removeProperty<T, K extends (keyof T & string)>(object: T, remov
}
// change the name of a property
export function renameProperty<T, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T {
export function renameProperty<T extends Object, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T {
const warn = warnOnce(oldName, newName);
// if the new property isn't there yet,

View file

@ -122,7 +122,10 @@ if (nodeIntegration) {
}
}
const { preloadPaths } = ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_NONSANDBOX_LOAD);
const { preloadPaths } = ipcRendererUtils.invokeSync<{
preloadPaths: string[]
}>(IPC_MESSAGES.BROWSER_NONSANDBOX_LOAD);
// Load the preload scripts.
for (const preloadScript of preloadPaths) {
try {

View file

@ -30,7 +30,7 @@ export const windowSetup = (isWebView: boolean, isHiddenPage: boolean) => {
let cachedVisibilityState = isHiddenPage ? 'hidden' : 'visible';
// Subscribe to visibilityState changes.
ipcRendererInternal.on(IPC_MESSAGES.GUEST_INSTANCE_VISIBILITY_CHANGE, function (_event, visibilityState: VisibilityState) {
ipcRendererInternal.on(IPC_MESSAGES.GUEST_INSTANCE_VISIBILITY_CHANGE, function (_event, visibilityState: DocumentVisibilityState) {
if (cachedVisibilityState !== visibilityState) {
cachedVisibilityState = visibilityState;
document.dispatchEvent(new Event('visibilitychange'));

View file

@ -30,7 +30,17 @@ Object.setPrototypeOf(process, EventEmitter.prototype);
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal') as typeof ipcRendererInternalModule;
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils') as typeof ipcRendererUtilsModule;
const { preloadScripts, process: processProps } = ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_SANDBOX_LOAD);
const {
preloadScripts,
process: processProps
} = ipcRendererUtils.invokeSync<{
preloadScripts: {
preloadPath: string;
preloadSrc: string | null;
preloadError: null | Error;
}[];
process: NodeJS.Process;
}>(IPC_MESSAGES.BROWSER_SANDBOX_LOAD);
const electron = require('electron');