声明文件中的枚举命名空间?

enum namespace in a declaration file?

提问人:luke23545234 提问时间:3/23/2023 更新时间:3/23/2023 访问量:34

问:

我有一个 php->typescript 转换器,它从 PHP 生成打字稿声明文件。请告诉我如何从以下内容创建相应的 ts 语句块:

dto.d.ts

declare namespace App.Data.Utils {
    export type Columns {
       id: string;
       label: string;
    }
    export enum SortDirection {
        "ASC" = "asc",
        "DESC" = "desc",
    }
}

仅从声明文件中复制枚举结构的问题将导致 App.Data.Utils.Columns 未声明

dto.d.ts

export namespace App.Data.Utils {
    export enum SortDirection {
        "ASC" = "asc",
        "DESC" = "desc",
    }
}

插入

dto.d.ts

export namespace App.Data.Utils {
    export type Columns {
       id: string;
       label: string;
    }
    export enum SortDirection {
        "ASC" = "asc",
        "DESC" = "desc",
    }
}

导致 babel 的运行时问题(我正在使用 CRA)

TypeScript 枚举 命名空间 create-react-app

评论


答: 暂无答案