Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Typescript definitions #118

Open
dinvlad opened this issue Oct 4, 2016 · 1 comment
Open

Typescript definitions #118

dinvlad opened this issue Oct 4, 2016 · 1 comment

Comments

@dinvlad
Copy link

dinvlad commented Oct 4, 2016

Is there a .d.ts for Auth0LockPasswordless, akin to that of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/auth0.lock ?

If there isn't one, is it possible to adapt the one from the link with only a few minor modifications - in other words, are their APIs compatible (apart from the constructor and such)?

EDIT: Or would that even matter from a client's perspective - one only needs to call the constructor and a show-like method (.emailcode etc.), at least for basic use. So would it be sufficient to create abridged definitions only for these?

Thanks

@dinvlad
Copy link
Author

dinvlad commented Oct 4, 2016

The simplest case of type definitions from the above indeed seems to be sufficient (at least, Lock is loaded successfully from Typescript and there are no errors reported in the console):

interface Auth0LockPasswordlessStatic {
  new (clientId: string, domain: string): Auth0LockPasswordlessStatic;
  getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void;

  close(): void;
  destroy(): void;
  parseHash(hash: string): Auth0DecodedHash;
  logout(query: any): void;

  requestGravatar(email: string): void;

  emailcode(options?: Auth0LockConstructorOptions): void;
  socialOrEmailcode(options?: Auth0LockConstructorOptions): void;
}

declare var Auth0LockPasswordless: Auth0LockPasswordlessStatic;

declare module "auth0-lock-passwordless" {
    export = Auth0LockPasswordless;
}

Are there any hidden gotchas to this use?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant