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

Building app with node-eventstore-client fails due to long type in typescript #105

Open
ericlau-solid opened this issue Jan 21, 2025 · 1 comment

Comments

@ericlau-solid
Copy link

ericlau-solid commented Jan 21, 2025

This works perfectly fine in development. When attempting to run a build (ie. tsc), I get the following errors. Note that
"@types/long": "^4.0.1", no longer exists, "long": "^5.2.4", has its own typescript definition. I removed @types/long from my app's package.json, but that only makes it worse. (all errors due to index.d.ts cannot find name 'Long')

Did some digging. Long is having some goofiness with typescript 5.2. dcodeIO/long.js#130.

Ultimately the app should work without any @types/long

node_modules/node-eventstore-client/index.d.ts:2:23 - error TS1261: Already included file name '/Users/ericlau/WebstormProjects/card-club-mgt/api/node_modules/@types/Long/index.d.ts' differs from file name '/Users/ericlau/WebstormProjects/card-club-mgt/api/node_modules/@types/long/index.d.ts' only in casing.
  The file is in the program because:
    Type library referenced via 'Long' from file '/Users/ericlau/WebstormProjects/card-club-mgt/api/node_modules/node-eventstore-client/index.d.ts' with packageId '@types/long/index.d.ts@4.0.2'
    Entry point for implicit type library 'long' with packageId '@types/long/index.d.ts@4.0.2'

2 /// <reference types="Long" />
                        ~~~~


Found 1 error in node_modules/node-eventstore-client/index.d.ts:2
@ericlau-solid
Copy link
Author

ericlau-solid commented Jan 21, 2025

I rigged the index.d.ts file in my project, and once I removed this line:

/// <reference types="Long" />

and replace with this line:

import Long = require('long');

I was able to build. The solution isn't the best since it's a workaround. Turning on esModuleInterop is a better fix, but I leave it to you whether you want to do that.

While at it, please upgrade long npm library version to 5.2.4, uuid to 11.0.5

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

1 participant