node-ldapauth-fork icon indicating copy to clipboard operation
node-ldapauth-fork copied to clipboard

Typescript definition doesn't export class LdapAuth

Open Eymux opened this issue 7 years ago • 2 comments

In ldapauth.d.ts the class LdapAuth isn't part of the namespace LdapAuth and isn't exported.

Moving the class to the namespace seems to fix this.

Eymux avatar Sep 20 '17 13:09 Eymux

It might be incorrect, yes, as I find writing those typedefs a bit cumbersome. I did follow examples of existing typedefs and can use it like I intended:

import * as LdapAuth from 'ldapauth-fork';

const la = new LdapAuth({
  url: 'url',
  bindDN: 'test',
  bindCredentials: 'test',
  searchBase: 'base',
  searchFilter: 'filter'
});

la.authenticate('uname', 'password', () => {
  console.log('done')
})

If the class is moved inside the namespace the I should do new LdapAuth.LdapAuth in the example above.

vesse avatar Sep 20 '17 16:09 vesse

Sorry, I was using the wrong account.

If the class is in the namespace it can be imported like this:

import { LdapAuth } from 'ldapauth-fork';

Which is nicer and I believe how it should be.

Eymux avatar Sep 21 '17 13:09 Eymux