mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 02:26:21 +08:00
build: enhance tsconfig type check (#2732)
This commit is contained in:
@@ -29,13 +29,14 @@ export const quitAndInstall = async () => {
|
||||
let lastCheckTime = 0;
|
||||
export const checkForUpdatesAndNotify = async (force = true) => {
|
||||
if (!_autoUpdater) {
|
||||
return; // ?
|
||||
return void 0;
|
||||
}
|
||||
// check every 30 minutes (1800 seconds) at most
|
||||
if (force || lastCheckTime + 1000 * 1800 < Date.now()) {
|
||||
lastCheckTime = Date.now();
|
||||
return await _autoUpdater.checkForUpdatesAndNotify();
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
|
||||
export const registerUpdater = async () => {
|
||||
|
||||
@@ -27,6 +27,7 @@ import { contextBridge, ipcRenderer } from 'electron';
|
||||
if (validateIPC(channel)) {
|
||||
return ipcRenderer.invoke(channel, ...args);
|
||||
}
|
||||
return void 0;
|
||||
},
|
||||
|
||||
on(
|
||||
@@ -35,9 +36,8 @@ import { contextBridge, ipcRenderer } from 'electron';
|
||||
) {
|
||||
if (validateIPC(channel)) {
|
||||
ipcRenderer.on(channel, listener);
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
once(
|
||||
@@ -46,9 +46,8 @@ import { contextBridge, ipcRenderer } from 'electron';
|
||||
) {
|
||||
if (validateIPC(channel)) {
|
||||
ipcRenderer.once(channel, listener);
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
removeListener(
|
||||
@@ -57,9 +56,8 @@ import { contextBridge, ipcRenderer } from 'electron';
|
||||
) {
|
||||
if (validateIPC(channel)) {
|
||||
ipcRenderer.removeListener(channel, listener);
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import {
|
||||
CanActivate,
|
||||
createParamDecorator,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import type { CanActivate, ExecutionContext } from '@nestjs/common';
|
||||
import { createParamDecorator, Injectable, UseGuards } from '@nestjs/common';
|
||||
|
||||
import { PrismaService } from '../../prisma';
|
||||
import { getRequestResponseFromContext } from '../../utils/nestjs';
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
ResolveField,
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
import { Request } from 'express';
|
||||
import type { Request } from 'express';
|
||||
|
||||
import { UserType } from '../users/resolver';
|
||||
import { CurrentUser } from './guard';
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
import { compare, hash } from '@node-rs/bcrypt';
|
||||
import { User } from '@prisma/client';
|
||||
import type { User } from '@prisma/client';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
import { Config } from '../../config';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { equal, ok } from 'node:assert';
|
||||
import { afterEach, beforeEach, describe, test } from 'node:test';
|
||||
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { hash } from '@node-rs/bcrypt';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { ArgumentsHost, ExecutionContext } from '@nestjs/common';
|
||||
import {
|
||||
GqlArgumentsHost,
|
||||
GqlContextType,
|
||||
GqlExecutionContext,
|
||||
} from '@nestjs/graphql';
|
||||
import { Request, Response } from 'express';
|
||||
import type { ArgumentsHost, ExecutionContext } from '@nestjs/common';
|
||||
import type { GqlContextType } from '@nestjs/graphql';
|
||||
import { GqlArgumentsHost, GqlExecutionContext } from '@nestjs/graphql';
|
||||
import type { Request, Response } from 'express';
|
||||
|
||||
export function getRequestResponseFromContext(context: ExecutionContext) {
|
||||
switch (context.getType<GqlContextType>()) {
|
||||
|
||||
@@ -30,7 +30,7 @@ export class AffineErrorBoundary extends Component<
|
||||
AffineErrorBoundaryProps,
|
||||
AffineErrorBoundaryState
|
||||
> {
|
||||
public state: AffineErrorBoundaryState = {
|
||||
public override state: AffineErrorBoundaryState = {
|
||||
error: null,
|
||||
};
|
||||
|
||||
@@ -40,11 +40,11 @@ export class AffineErrorBoundary extends Component<
|
||||
return { error };
|
||||
}
|
||||
|
||||
public componentDidCatch(error: AffineError, errorInfo: ErrorInfo) {
|
||||
public override componentDidCatch(error: AffineError, errorInfo: ErrorInfo) {
|
||||
console.error('Uncaught error:', error, errorInfo);
|
||||
}
|
||||
|
||||
public render(): ReactNode {
|
||||
public override render(): ReactNode {
|
||||
if (this.state.error) {
|
||||
const error = this.state.error;
|
||||
if (error instanceof PageNotFoundError) {
|
||||
|
||||
@@ -80,6 +80,7 @@ const PageListEmpty = (props: {
|
||||
if (listType === 'shared') {
|
||||
return t['emptySharedPages']();
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -268,6 +268,7 @@ export const WorkspaceLayout: FC<PropsWithChildren> =
|
||||
affineGlobalChannel.disconnect();
|
||||
};
|
||||
}
|
||||
return;
|
||||
}, [currentWorkspaceId, jotaiWorkspaces]);
|
||||
|
||||
const Provider =
|
||||
|
||||
@@ -12,7 +12,7 @@ const description =
|
||||
export default class AppDocument extends Document<{
|
||||
emotionStyleTags: EmotionJSX.Element[];
|
||||
}> {
|
||||
static getInitialProps = async (ctx: DocumentContext) => {
|
||||
static override getInitialProps = async (ctx: DocumentContext) => {
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
|
||||
const cache = createEmotionCache();
|
||||
@@ -41,7 +41,7 @@ export default class AppDocument extends Document<{
|
||||
emotionStyleTags,
|
||||
};
|
||||
};
|
||||
render() {
|
||||
override render() {
|
||||
return (
|
||||
<Html>
|
||||
<Head>
|
||||
|
||||
@@ -63,6 +63,7 @@ const IndexPageInner = () => {
|
||||
} else {
|
||||
console.warn('No target workspace. This should not happen in production');
|
||||
}
|
||||
return;
|
||||
}, [helper, jumpToPage, jumpToSubPath, router, workspaces]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user