在Typescript中扩展外部类型声明

时间:2017-12-11 20:20:27

标签: typescript typescript-typings antd

我正在使用Typescript和ant设计库,我正在尝试扩展其中一个接口,只是为了添加单个属性。 我可以导入原始界面(所以你知道文件夹结构):

typings/antd

我不知道如何扩展它。

我在项目根目录中创建了一个tsconfig.json文件夹,将路径配置添加到baseUrl(以及"paths": { "antd": [ "node_modules/antd", "typings/antd" ] } ):

export interface CollapsePanelProps {
  showArrow?: boolean;
}

我尝试了不同的导出扩展接口的变体,如:

typings/antd/index.d.ts
Collapse.d.ts

中的

或者我试图模仿antd文件夹结构并将typings/antd/collapse文件放在{{1}}

或者尝试在我的打字文件中声明命名空间antd并将界面放在里面。

这些似乎都不起作用。

1 个答案:

答案 0 :(得分:0)

我的理解是声明文件只适用于外部Javascript文件。

您是否可以扩展原始界面并在代码中使用您的界面?

; with base as
    (
        select s.sale#
        , p.SaleID
        , r.POID
        , r.Received
        from dbo.Sale as s
        inner join dbo.PO as p on s.ID = p.SaleID
        inner join dbo.Received as r on p.ID = r.POID   
    )
    , all_true as
    (
        --this sub-query is the filter for Sale#'s of interest
        select b.sale#
        from base as b
        group by b.sale#
        having sum(case b.Received when 'True' then 1 else 0 end) = count(*) --count-if = count 
    )
select b.*
from base as b
inner join all_true as t on b.sale# = t.sale#
相关问题