Skip to content

[0.19.0][Regression] latest release has broken typescript types #246

Description

@AviVahl

Saw this issue in our downstream project.
Got broken by #244

Steps to reproduce:

mkdir mixpanel-type-issue
cd mixpanel-type-issue
npm init -y
npm pkg set type=module
npm i mixpanel typescript
npx tsc --init --skipLibCheck false
echo "import mixpanel from 'mixpanel'; mixpanel.init('token');" > main.ts
npx tsc --noEmit

Results in:

node_modules/mixpanel/lib/flags/local_flags.d.ts:6:10 - error TS2305: Module '"../mixpanel-node"' has no exported member 'CustomLogger'.

6 import { CustomLogger } from '../mixpanel-node';
           ~~~~~~~~~~~~

node_modules/mixpanel/lib/flags/remote_flags.d.ts:5:10 - error TS2305: Module '"../mixpanel-node"' has no exported member 'CustomLogger'.

5 import { CustomLogger } from '../mixpanel-node'
           ~~~~~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:5:15 - error TS2451: Cannot redeclare block-scoped variable 'mixpanel'.

5 declare const mixpanel: mixpanel.Mixpanel;
                ~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:5:25 - error TS2503: Cannot find namespace 'mixpanel'.

5 declare const mixpanel: mixpanel.Mixpanel;
                          ~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:7:19 - error TS2451: Cannot redeclare block-scoped variable 'mixpanel'.

7 declare namespace mixpanel {
                    ~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:167:85 - error TS1194: Export declarations are not permitted in a namespace.

167   export { LocalFlagsConfig, RemoteFlagsConfig, FlagContext, SelectedVariant } from './flags/types';
                                                                                        ~~~~~~~~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:168:56 - error TS1194: Export declarations are not permitted in a namespace.

168   export { default as LocalFeatureFlagsProvider } from './flags/local_flags';
                                                           ~~~~~~~~~~~~~~~~~~~~~

node_modules/mixpanel/lib/mixpanel-node.d.ts:169:57 - error TS1194: Export declarations are not permitted in a namespace.

169   export { default as RemoteFeatureFlagsProvider } from './flags/remote_flags';
                                                            ~~~~~~~~~~~~~~~~~~~~~~


Found 8 errors in 3 files.

Errors  Files
     1  node_modules/mixpanel/lib/flags/local_flags.d.ts:6
     1  node_modules/mixpanel/lib/flags/remote_flags.d.ts:5
     6  node_modules/mixpanel/lib/mixpanel-node.d.ts:5

Same commands with mixpanel@0.18.1 work and pass type check.

FYI @tdumitrescu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions