3

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);

1 Answer 1

4
declare module Namespace {
    class TargetClass {
        constructor(arg1: string, arg2: number);
        someFunc(arg3: any): void;
    }   
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.