chore: enable noUncheckedIndexedAccess, better type check (#2608)

This commit is contained in:
Stephen Zhou
2025-01-18 22:35:23 +08:00
committed by GitHub
parent f947bd1d1e
commit 2cd1b5daf9
182 changed files with 489 additions and 589 deletions
+3
View File
@@ -66,7 +66,9 @@ interface RenderGlobalContext {
}
export const registerGlobalContext = (context: Partial<RenderGlobalContext>) => {
// @ts-ignore
globalThis[PREFIX] = {
// @ts-ignore
...globalThis[PREFIX],
...context,
}
@@ -135,5 +137,6 @@ export function callWebviewExpose<T extends RenderGlobalContext>(
}
export function callWindowExposeRenderer() {
// @ts-ignore
return globalThis[PREFIX] as Fn<RenderGlobalContext>
}
+1
View File
@@ -7,6 +7,7 @@ declare const globalThis: {
electron?: ElectronAPI
api?: { canWindowBlur: boolean }
}
electron?: ElectronAPI
}
export const APP_PROTOCOL = isDev ? "follow-dev" : "follow"
+2 -1
View File
@@ -49,6 +49,7 @@ function getRuntimeEnv() {
}
}
declare const globalThis: any
function injectExternalEnv<T>(originEnv: T): T {
if (!("document" in globalThis)) {
return originEnv
@@ -60,7 +61,7 @@ function injectExternalEnv<T>(originEnv: T): T {
}
for (const key in env) {
originEnv[key] = env[key]
originEnv[key as keyof T] = env[key]
}
return originEnv
}