chore: enable noUncheckedIndexedAccess, better type check (#2608)
This commit is contained in:
@@ -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>
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ declare const globalThis: {
|
||||
electron?: ElectronAPI
|
||||
api?: { canWindowBlur: boolean }
|
||||
}
|
||||
electron?: ElectronAPI
|
||||
}
|
||||
|
||||
export const APP_PROTOCOL = isDev ? "follow-dev" : "follow"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user