chore: standardize tsconfig (#9568)

This commit is contained in:
forehalo
2025-01-08 04:07:56 +00:00
parent 39f4b17315
commit c0ed74dfed
151 changed files with 1041 additions and 1566 deletions
+32
View File
@@ -0,0 +1,32 @@
declare interface BUILD_CONFIG_TYPE {
debug: boolean;
distribution: 'web' | 'desktop' | 'admin' | 'mobile' | 'ios' | 'android';
/**
* 'web' | 'desktop' | 'admin'
*/
isDesktopEdition: boolean;
/**
* 'mobile'
*/
isMobileEdition: boolean;
isElectron: boolean;
isWeb: boolean;
isMobileWeb: boolean;
isIOS: boolean;
isAndroid: boolean;
isAdmin: boolean;
appVersion: string;
editorVersion: string;
appBuildType: 'stable' | 'beta' | 'internal' | 'canary';
githubUrl: string;
changelogUrl: string;
downloadUrl: string;
// see: tools/workers
imageProxyUrl: string;
linkPreviewUrl: string;
}
declare var BUILD_CONFIG: BUILD_CONFIG_TYPE;
+7
View File
@@ -0,0 +1,7 @@
{
"name": "@types/build-config",
"private": true,
"types": "./__all.d.ts",
"type": "module",
"version": "0.19.0"
}
+34 -20
View File
@@ -1,26 +1,6 @@
import '@affine/env/constant';
import '@blocksuite/affine/global/types'
import type { BUILD_CONFIG_TYPE, Environment } from '@affine/env/global';
declare global {
// eslint-disable-next-line no-var
var process: {
env: Record<string, string>;
};
// eslint-disable-next-line no-var
var environment: Environment;
// eslint-disable-next-line no-var
var BUILD_CONFIG: BUILD_CONFIG_TYPE;
// eslint-disable-next-line no-var
var $AFFINE_SETUP: boolean | undefined;
/**
* Inject by https://www.npmjs.com/package/@sentry/webpack-plugin
*/
// eslint-disable-next-line no-var
var SENTRY_RELEASE: { id: string } | undefined;
}
declare module '@blocksuite/affine/store' {
interface DocMeta {
/**
@@ -35,3 +15,37 @@ declare module '@blocksuite/affine/store' {
isPublic?: boolean;
}
}
declare global {
declare type Environment = {
// Variant
isSelfHosted: boolean;
// Device
isLinux: boolean;
isMacOs: boolean;
isIOS: boolean;
isSafari: boolean;
isWindows: boolean;
isFireFox: boolean;
isMobile: boolean;
isChrome: boolean;
isPwa: boolean;
chromeVersion?: number;
// runtime configs
publicPath: string;
};
var process: {
env: Record<string, string>;
};
var environment: Environment;
var $AFFINE_SETUP: boolean | undefined;
/**
* Inject by https://www.npmjs.com/package/@sentry/webpack-plugin
*/
var SENTRY_RELEASE: { id: string } | undefined;
}