V
V
vetsmen2019-09-08 23:07:04
typescript
vetsmen, 2019-09-08 23:07:04

How to extend the functionality of the library?

There is a library with the following structure:

declare class LibName extends events.EventEmitter { }

declare namespace LibName {
...
class Server extends events.EventEmitter {}
...
}

export = LibName

How can it be expanded, while transferring all the functionality of namespaces?
I need to expand exactly LibName by adding a public value to it, and at the same time extend the Server functionality from neipspaces.
Dropped something like this:
import * as LibName from "libname";

class CustomLibName extends LibName {}
namespace CustomLibName {
    export class Server extends LibName.Server {}
}

export = CustomLibName

But if I add a parameter to the class CustomLibName and try to access it through the class Server, then I get an error that it is not visible. How to be? In the library itself, Server somehow sees other parameters from LibName.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question