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

[Bug]: tsconfig.json should be excluded from packages (e.g. from npm) #6755

Open
Akim-Personal opened this issue Apr 25, 2024 · 1 comment
Open
Labels
bug Something isn't working libraries Impacts the Libraries triage In need of triage

Comments

@Akim-Personal
Copy link

Impacted Library name

@ledgerhq/hw-transport

Impacted Library version

6.30.6

Describe the bug

This might well apply to other libraries.

It looks like the tsconfig.json file should be excluded from the package
(https://github.com/LedgerHQ/ledger-live/blob/develop/libs/ledgerjs/packages/hw-transport/tsconfig.json)
because, that file extends a tsconfig.json file, which is not present when getting the package via npm.

{ "extends": "../../tsconfig.json", <-- NOT PRESENT "compilerOptions": { "outDir": "lib" }, "include": ["src/**/*"] }

Further, Transport.ts starts with
import EventEmitter from "events";
This code is only valid with "esModuleInterop": true - which would work, if the extending would have worked, but it is better to just remove the tsconfig.ts file and leave the responsibility to the root tsconfig file.

An alternative (or probably a better additional fix) ) would be to change the first line in Transport.ts to
import { EventEmitter } from "events";

Expected behavior

No TS validation errors and being able to build the production project with Vite, npm run build.

Additional context

There seems to be one last conflict down the line, probably unrelated, but at least I want to mention it.
Inside Transport.ts line 377
if (resolveBusy) resolveBusy();
is unable to build due to error
This expression is not callable. Type 'never' has no call signatures.ts(2349) let resolveBusy: never

I haven't investigated this issue further yet - so I cannot say much about it yet besides that it is another issue which is requiring a fix to have that package fully working in production builds created with Vite.

@Akim-Personal Akim-Personal added bug Something isn't working libraries Impacts the Libraries triage In need of triage labels Apr 25, 2024
@Akim-Personal
Copy link
Author

The issue with resolveBusy, I mentioned in the additional context, seems to be easily fixable by applying an any type in line 348:

let resolveBusy: any;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libraries Impacts the Libraries triage In need of triage
Projects
None yet
Development

No branches or pull requests

1 participant