PostHog / posthog-node

Official PostHog Node library
MIT License
21 stars 19 forks source link

Fix type definitions #65

Closed Alkasai closed 1 year ago

Alkasai commented 2 years ago

Related to this issue: https://github.com/PostHog/posthog-node/issues/50

We could use this type definitions to better represent the code in index.js and allow user to use import PostHog = require('posthog-node'); or import PostHog from 'posthog-node';

aravind-opsverse commented 2 years ago

I tested this change. It works fine in NestJS. Hence approving the PR.

mariusandra commented 1 year ago

Hey @Alkasai and @aravind-opsverse , thanks for the PR and the review. I'm unfortunately going to pause this, as we're in the progress of refactoring all our JS integrations (web, node & react native) into one unified JS monorepo.

Work on that is happening in the following branches:

Once that's done, all types will be autogenerated and we won't have to worry about manually updating index.d.ts anymore.

Thanks again for the PR!

adrianwix commented 1 year ago

@mariusandra Any clue how to solve the issue mentioned by the OP? We get "posthog_node_1.default is not a constructor" when running it with typescript in Nestjs

mariusandra commented 1 year ago

Please try version 2.0.0 (or 2.0.1) of posthog-node, which is built on top of a new codebase.