Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings? #48

Open
tommedema opened this issue Jul 16, 2020 · 6 comments
Open

Typings? #48

tommedema opened this issue Jul 16, 2020 · 6 comments

Comments

@tommedema
Copy link

Are there typescript typings?

@FritzTheDev
Copy link

@tommedema, I haven't found any so I'm going to see what the API surface area looks like and try writing some if it's not too big. Feel free to tag me here if you want to check on them.

@randalvance
Copy link

Our team is also looking for the official typings for this. Thanks.

@FritzTheDev
Copy link

@randalvance @tommedema I'm no longer working on the Typings for this - the API was going to make it hard and the benefit to me wasn't that big. Good luck!

@tommedema
Copy link
Author

@randalvance any update on this?

@tommedema
Copy link
Author

tommedema commented Feb 20, 2021

at bubbles we worked around this by creating a custom typings definition tailored to our use case:

typings/clearbit/index.d.ts

declare function clearbit(apiKey: string): Clearbit.IClearbitClient

/**
 * @see https://stackoverflow.com/a/33392782/45974
 */
declare namespace Clearbit {
  interface IPerson {
    setVersion: (version: '2019-12-19') => void,
  }

  interface IEnrichment {
    find: ({email: string, stream: boolean}) => Promise<Clearbit.IEnrichmentResult>
  }

  interface IEnrichmentResult {
    person: object | null
    company: object | null
  }

  interface IClearbitClient {
    Person: Clearbit.IPerson,
    Enrichment: Clearbit.IEnrichment
  }
}

export = clearbit

@wbobeirne
Copy link

wbobeirne commented Jun 30, 2021

Would love to see some official typings from the Clearbit team, especially since the docs have this note about Person and Company:

No attributes are guaranteed to be present

The difference between no key defined, null, empty string, and empty array can be really important! I could do a few responses and guess at what the shape and assurances are of data availability, but having something more dependable would be great.

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

No branches or pull requests

4 participants