如何在Kotlin中声明外部打字类型

发布于 2025-02-09 12:49:44 字数 1199 浏览 2 评论 0 原文

我需要访问kotlin-js的打字稿库(react-admin) 特别是此类型定义

例如,如何在Kotlinjs中声明以下类型?

export type AuthProvider = {
    login: (params: any) => Promise<any>;
    logout: (params: any) => Promise<void | false | string>;
    checkAuth: (params: any) => Promise<void>;
    checkError: (error: any) => Promise<void>;
    getIdentity?: () => Promise<UserIdentity>;
    getPermissions: (params: any) => Promise<any>;
    [key: string]: any;
};




export type DataProvider<ResourceType extends string = string> = {
    getList: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetListParams
    ) => Promise<GetListResult<RecordType>>;

    getOne: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetOneParams
    ) => Promise<GetOneResult<RecordType>>;


// etc etc ...

}

谢谢

I need to access a Typescript library (react-admin) from kotlin-js
In particular this types definitions

https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/types.ts

How do I declare in kotlinjs for example the following types ?

export type AuthProvider = {
    login: (params: any) => Promise<any>;
    logout: (params: any) => Promise<void | false | string>;
    checkAuth: (params: any) => Promise<void>;
    checkError: (error: any) => Promise<void>;
    getIdentity?: () => Promise<UserIdentity>;
    getPermissions: (params: any) => Promise<any>;
    [key: string]: any;
};




export type DataProvider<ResourceType extends string = string> = {
    getList: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetListParams
    ) => Promise<GetListResult<RecordType>>;

    getOne: <RecordType extends RaRecord = any>(
        resource: ResourceType,
        params: GetOneParams
    ) => Promise<GetOneResult<RecordType>>;


// etc etc ...

}

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文