Skip to content

BmobPromise 无法使用 async/await 异步方法 #99

@yuzheng14

Description

@yuzheng14

typescript 中调用 Bomb.User.login() 时报错,出错代码:

const login = createAsyncThunk(
    'login/login',
    async ({ userId, passwd }: { userId: string, passwd: string }) => {
        let res = await Bomb.User.login(userId,passwd)
    }
)

报错:

类型在其自身的 "then" 方法的 fulfillment 回调中被直接或间接引用。

看声明文件中写的 export interface BmobPromise<T = any> extends Promise<BmobPromise<T>> {} 是 Promise 的子类,按理来说应该能用 async/await

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions