Fionn
Fionn

Reputation: 11265

Typescript definition for a class within a namespace

how can I create a typescript definition file "*.d.ts" for a class inside a namespace with constructor arguments (existing javascript library). I tried several combinations of a module with a nested interface, but nothing worked so far.

Example:

var instance = new Namespace.TargetClass(arg1, arg2);
instance.someFunc(arg3);

Upvotes: 3

Views: 1928

Answers (1)

Ryan Cavanaugh
Ryan Cavanaugh

Reputation: 220944

declare module Namespace {
    class TargetClass {
        constructor(arg1: string, arg2: number);
        someFunc(arg3: any): void;
    }   
}

Upvotes: 4

Related Questions