网站搜索

如何在 TypeScript 内置类型中扩展类型


我想在 typescript/lib/lib.dom.d.ts 中扩展类型 File

我尝试使用这段代码

declare module "typescript/lib/lib.dom.d"
{
    interface File
    {
        readonly filepath?: string
        readonly webkitRelativePath?: string
    }
}

但是这失败了

有人知道怎么做吗?