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 { interface GuestInstance {
elementInstanceId: number; elementInstanceId: number;
visibilityState?: VisibilityState; visibilityState?: DocumentVisibilityState;
embedder: Electron.WebContents; embedder: Electron.WebContents;
guest: Electron.WebContents; guest: Electron.WebContents;
} }
@ -229,7 +229,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
watchedEmbedders.add(embedder); watchedEmbedders.add(embedder);
// Forward embedder window visibility change events to guest // Forward embedder window visibility change events to guest
const onVisibilityChange = function (visibilityState: VisibilityState) { const onVisibilityChange = function (visibilityState: DocumentVisibilityState) {
for (const guestInstance of guestInstances.values()) { for (const guestInstance of guestInstances.values()) {
guestInstance.visibilityState = visibilityState; guestInstance.visibilityState = visibilityState;
if (guestInstance.embedder === embedder) { 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 // 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); const warn = warnOnce(oldName, newName);
// if the new property isn't there yet, // 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. // Load the preload scripts.
for (const preloadScript of preloadPaths) { for (const preloadScript of preloadPaths) {
try { try {

View file

@ -30,7 +30,7 @@ export const windowSetup = (isWebView: boolean, isHiddenPage: boolean) => {
let cachedVisibilityState = isHiddenPage ? 'hidden' : 'visible'; let cachedVisibilityState = isHiddenPage ? 'hidden' : 'visible';
// Subscribe to visibilityState changes. // 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) { if (cachedVisibilityState !== visibilityState) {
cachedVisibilityState = visibilityState; cachedVisibilityState = visibilityState;
document.dispatchEvent(new Event('visibilitychange')); 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 { 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 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'); const electron = require('electron');

View file

@ -70,7 +70,7 @@
"timers-browserify": "1.4.2", "timers-browserify": "1.4.2",
"ts-loader": "^8.0.2", "ts-loader": "^8.0.2",
"ts-node": "6.2.0", "ts-node": "6.2.0",
"typescript": "^4.5.5", "typescript": "^5.1.2",
"url": "^0.11.0", "url": "^0.11.0",
"webpack": "^5.76.0", "webpack": "^5.76.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",

View file

@ -6645,10 +6645,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^4.5.5: typescript@^5.1.2:
version "4.5.5" version "5.1.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826"
integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==
uc.micro@^1.0.1, uc.micro@^1.0.5: uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.6" version "1.0.6"