style: restrict type import (#1589)

This commit is contained in:
Himself65
2023-03-15 11:58:43 -05:00
committed by GitHub
parent 6ab2f83e13
commit efcf1fcaa0
154 changed files with 332 additions and 307 deletions

View File

@@ -1,5 +1,5 @@
import { DebugLogger } from '@affine/debug';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { MessageCenter } from './message';

View File

@@ -1,6 +1,6 @@
import { Observable } from 'lib0/observable';
import { Message } from '../types';
import type { Message } from '../types';
import { MessageCode, messages } from './code';
export class MessageCenter extends Observable<string> {

View File

@@ -1,6 +1,6 @@
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { KyInstance } from 'ky/distribution/types/ky';
import type { KyInstance } from 'ky/distribution/types/ky';
import { MessageCenter } from '../../message';
import type { User } from '../../types';
@@ -12,8 +12,8 @@ import type {
ProviderConstructorParams,
} from '../base';
import { BaseProvider } from '../base';
import type { Apis, WorkspaceDetail } from './apis';
import { getApis, Workspace } from './apis';
import type { Apis, Workspace, WorkspaceDetail } from './apis';
import { getApis } from './apis';
import { createGoogleAuth } from './apis/google';
import { createAuthClient, createBareClient } from './apis/request';
import { WebsocketClient } from './channel';

View File

@@ -1,6 +1,7 @@
import { DebugLogger } from '@affine/debug';
import { initializeApp } from 'firebase/app';
import { connectAuthEmulator, User } from 'firebase/auth';
import type { User } from 'firebase/auth';
import { connectAuthEmulator } from 'firebase/auth';
import {
type Auth as FirebaseAuth,
getAuth as getFirebaseAuth,
@@ -9,7 +10,7 @@ import {
signOut,
} from 'firebase/auth';
import { decode } from 'js-base64';
import { KyInstance } from 'ky/distribution/types/ky';
import type { KyInstance } from 'ky/distribution/types/ky';
import { MessageCenter } from '../../../message';
import { storage } from '../storage';

View File

@@ -1,8 +1,9 @@
export type { Callback } from './google';
import { KyInstance } from 'ky/distribution/types/ky';
import type { KyInstance } from 'ky/distribution/types/ky';
import { createGoogleAuth, getAuthorizer, GoogleAuth } from './google';
import type { createGoogleAuth, GoogleAuth } from './google';
import { getAuthorizer } from './google';
import { createUserApis } from './user';
import { createWorkspaceApis } from './workspace';

View File

@@ -1,7 +1,7 @@
import ky from 'ky-universal';
import { MessageCenter } from '../../../message';
import { GoogleAuth } from './google';
import type { GoogleAuth } from './google';
type KyInstance = typeof ky;

View File

@@ -1,4 +1,4 @@
import { KyInstance } from 'ky/distribution/types/ky';
import type { KyInstance } from 'ky/distribution/types/ky';
export interface GetUserByEmailParams {
email: string;

View File

@@ -1,8 +1,8 @@
import { KyInstance } from 'ky/distribution/types/ky';
import type { KyInstance } from 'ky/distribution/types/ky';
import { MessageCenter } from '../../../message';
import { createBlocksuiteWorkspace as _createBlocksuiteWorkspace } from '../../../utils';
import { GoogleAuth } from './google';
import type { GoogleAuth } from './google';
import RequestError from './request-error';
import type { User } from './user';
const messageCenter = MessageCenter.getInstance();

View File

@@ -2,7 +2,7 @@ import { DebugLogger } from '@affine/debug';
import * as url from 'lib0/url';
import * as websocket from 'lib0/websocket';
import { GoogleAuth } from './apis/google';
import type { GoogleAuth } from './apis/google';
const RECONNECT_INTERVAL_TIME = 500;
const MAX_RECONNECT_TIMES = 50;

View File

@@ -1,12 +1,12 @@
import { DebugLogger } from '@affine/debug';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import { MessageCenter } from '../message';
import { User } from '../types';
import type { MessageCenter } from '../message';
import type { User } from '../types';
import type { WorkspaceUnit, WorkspaceUnitCtorParams } from '../workspace-unit';
import type { WorkspaceUnitCollectionScope } from '../workspace-unit-collection';
import { Member } from './affine/apis';
import { Permission } from './affine/apis/workspace';
import type { Member } from './affine/apis';
import type { Permission } from './affine/apis/workspace';
export interface ProviderConstructorParams {
workspaces: WorkspaceUnitCollectionScope;

View File

@@ -1,4 +1,5 @@
import { uuidv4, Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import { uuidv4 } from '@blocksuite/store';
import assert from 'assert';
import { varStorage as storage } from 'lib0/storage';

View File

@@ -1,11 +1,11 @@
import { GetBlob, PutBlob } from '../ipc/types/blob';
import {
import type { GetBlob, PutBlob } from '../ipc/types/blob';
import type {
GetDocumentParameter,
GetDocumentResponse,
YDocumentUpdate,
} from '../ipc/types/document';
import { CreateUser, GetUserParameters, User } from '../ipc/types/user';
import {
import type { CreateUser, GetUserParameters, User } from '../ipc/types/user';
import type {
CreateWorkspace,
CreateWorkspaceResult,
GetWorkspace,

View File

@@ -1,16 +1,19 @@
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import * as Y from 'yjs';
import { User } from '../../types';
import type { User } from '../../types';
import { applyUpdate } from '../../utils';
import type { WorkspaceUnit } from '../../workspace-unit';
import { CreateWorkspaceInfoParams, ProviderConstructorParams } from '../base';
import type {
CreateWorkspaceInfoParams,
ProviderConstructorParams,
} from '../base';
import { LocalProvider } from '../local';
import { loadWorkspaceUnit } from '../local/utils';
import { IPCBlobProvider } from './blocksuite-provider/blob';
import type { IPCMethodsType } from './ipc/methods';
import { WorkspaceWithPermission } from './ipc/types/workspace';
import type { WorkspaceWithPermission } from './ipc/types/workspace';
import { createWorkspaceUnit } from './utils';
/**

View File

@@ -1,13 +1,13 @@
import { invoke } from '@tauri-apps/api';
import { GetBlob, PutBlob } from './types/blob';
import {
import type { GetBlob, PutBlob } from './types/blob';
import type {
GetDocumentParameter,
GetDocumentResponse,
YDocumentUpdate,
} from './types/document';
import { CreateUser, GetUserParameters } from './types/user';
import {
import type { CreateUser, GetUserParameters } from './types/user';
import type {
CreateWorkspace,
CreateWorkspaceResult,
GetWorkspace,

View File

@@ -1,4 +1,4 @@
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { getDefaultHeadImgBlob } from '../utils';

View File

@@ -8,6 +8,7 @@
// memberCount: number;
// provider: string;
// };
import type { DebugLogger } from '@affine/debug';
declare global {
interface Window {
@@ -24,8 +25,7 @@ export type User = {
};
// export type WorkspaceMeta = Pick<WorkspaceInfo, 'name' | 'avatar'>;
export type Logger = typeof import('@affine/debug').DebugLogger;
export type Logger = DebugLogger;
export type Message = {
code: number;

View File

@@ -1,8 +1,6 @@
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import {
StoreOptions,
Workspace as BlocksuiteWorkspace,
} from '@blocksuite/store';
import type { StoreOptions } from '@blocksuite/store';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
export const createBlocksuiteWorkspace = (options: StoreOptions) => {
return new BlocksuiteWorkspace({

View File

@@ -1,4 +1,4 @@
import {
import type {
BlobOptionsGetter,
Workspace as BlocksuiteWorkspace,
} from '@blocksuite/store';