fix: error TS2742: The inferred type of 'bareClient' cannot be name (#731)

This commit is contained in:
zuomeng wang 2023-01-13 15:33:42 +08:00 committed by GitHub
parent 7fb5aae8b5
commit ba9a57d4ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,11 +2,13 @@ import ky from 'ky-universal';
import { MessageCenter } from '../../../message/index.js';
import { token } from './token.js';
type KyInstance = typeof ky;
const messageCenter = MessageCenter.getInstance();
const _sendMessage = messageCenter.getMessageSender('affine');
export const bareClient = ky.extend({
export const bareClient: KyInstance = ky.extend({
prefixUrl: 'http://localhost:8080',
retry: 1,
hooks: {
@ -26,7 +28,7 @@ export const bareClient = ky.extend({
},
});
export const client = bareClient.extend({
export const client: KyInstance = bareClient.extend({
hooks: {
beforeRequest: [
async request => {