fix types

This commit is contained in:
Pig Fang 2020-08-28 11:23:17 +08:00
parent f85b3cb294
commit 329af60d74
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2

View File

@ -26,7 +26,7 @@ export function t(key: string, params?: object) {
}
export const fetch = {
async get<T = any>(url: string, params?: Record<string, string>): Promise<T> {
async get<T = any>(url: string, params?: Record<string, any>): Promise<T> {
url
params
return {} as T
@ -50,8 +50,12 @@ export const fetch = {
const emitter = new EventEmitter()
export const event = {
on(eventName: string | symbol, listener: (...args: any[]) => any): void {
on(eventName: string | symbol, listener: (...args: any[]) => any): () => void {
emitter.on(eventName, listener)
return () => {
emitter.off(eventName, listener)
}
},
emit(eventName: string | symbol, payload?: object): void {
emitter.emit(eventName, payload)