typescript extend imported namespace

Solutions on MaxInterview for typescript extend imported namespace by the best coders in the world

showing results for - "typescript extend imported namespace"
Ella
27 Feb 2019
1// We can import a namespace in a non-declaration .ts, and export it again as a extended type:
2
3// custom-fc.ts : enhances declaration of FC namespace
4import * as origFC from "fullcalendar";
5
6declare namespace Complimentary {
7    class TimeGrid {
8        prepareHits(): void;
9    }
10    let views: any;
11}
12
13// apply additional types to origFc and export again
14export const FC: (typeof Complimentary & typeof origFC) = origFC as any;
15