I am currently working with Typescript and the ant design library. My goal is to extend an existing interface by adding a single property. To start, I imported the original interface so you can see the folder structure:
import { CollapseProps } from 'antd/lib/collapse/Collapse';
However, I'm unsure of how to properly extend it.
I have created a typings/antd
folder in the project root directory, added paths configuration to the tsconfig.json
file (including the baseUrl
):
"paths": {
"antd": [
"node_modules/antd",
"typings/antd"
]
}
I've attempted various ways to export extended interfaces such as:
export interface CollapsePanelProps {
showArrow?: boolean;
}
in the typings/antd/index.d.ts
file
Alternatively, I tried replicating the antd folder structure by placing the Collapse.d.ts
file inside typings/antd/collapse
or attempted declaring a namespace 'antd' in my typings file and including the interface within.
Unfortunately, none of these approaches seem to be working.