Answer the question
In order to leave comments, you need to log in
How to declare a library function in JS in TypeScript?
I am writing a tool in TypeScript.
There was a need to use the library:
npm i ad
Types did not find it for it. Slowly I try to create for myself.
And I don’t understand how to declare functions of the form:
ad.user().get(filter)
await ad.user().get({fields: 'sAMAccountName'});
ad.user().add(options)
await ad.user().add({
userName: 'jsmith'
commonName: 'John Smith',
password: '[email protected]!pt1'
});
export = ad;
declare class ad {
user().get()???
}
Answer the question
In order to leave comments, you need to log in
something like this:
user(): User
...
interface User {
get(options: GetOptions): Promise<Something>
add(options: AddOptions): Promise<SomethingElse>
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question