build: prevent tsconfig includes sources outside (#2643)

This commit is contained in:
LongYinan
2023-06-01 17:08:14 +08:00
parent 07a502e840
commit 6bd2e6a619
25 changed files with 160 additions and 107 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */
interface Window {
apis: typeof import('./src/affine-apis').apis;
events: typeof import('./src/affine-apis').events;
declare interface Window {
apis: import('./src/affine-apis').PreloadHandlers;
events: import('./src/affine-apis').MainIPCEventMap;
}
@@ -1,10 +1,14 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../constraints.d.ts" />
// NOTE: we will generate preload types from this file
import { ipcRenderer } from 'electron';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import type {
MainIPCEventMap,
MainIPCHandlerMap,
} from '../../main/src/exposed';
type WithoutFirstParameter<T> = T extends (_: any, ...args: infer P) => infer R
? (...args: P) => R
: T;
@@ -15,7 +19,7 @@ type HandlersMap<N extends keyof MainIPCHandlerMap> = {
>;
};
type PreloadHandlers = {
export type PreloadHandlers = {
[N in keyof MainIPCHandlerMap]: HandlersMap<N>;
};
@@ -88,3 +92,6 @@ const appInfo = {
};
export { apis, appInfo, events };
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
export type { MainIPCEventMap } from '../../main/src/exposed';