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

Is there a reason for including src in the final package #6604

Closed
arijoon opened this issue Nov 16, 2023 · 2 comments
Closed

Is there a reason for including src in the final package #6604

arijoon opened this issue Nov 16, 2023 · 2 comments

Comments

@arijoon
Copy link

arijoon commented Nov 16, 2023

Expected behavior

Successful typescript compilation

Actual behavior

web3-types/src/eth_types.ts:17:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'

Steps to reproduce the behavior

add the following compiler options to a typescript project:

    "importsNotUsedAsValues": "error",
    "skipLibCheck": true

Install web3 as a dependency and attempt to compile

Cause

Inclusion of src directory in all package is the main culprit. Even with skipLibCheck this error pops up due to compiler building every .ts file.

With the new typescript 5.5 this option will be removed, hence its not a major issue but basically indicates an unused import. Other than fixing the source the issue, I wondered if there's a reason for including src or it can be removed from the final artifact. This would also avoid recompilation by client applications

@Muhammad-Altabba
Copy link
Contributor

Thanks @arijoon,
This seems because of the same issue identified here: #6589 and would be fixed here: #6590

@Muhammad-Altabba
Copy link
Contributor

Hi @arijoon ,
The fix is now published to npm 4.2.3-dev.0dec262.0 with @dev tag. So, You can download it with npm i web3@4.2.3-dev.0dec262.0 or npm i web3@dev. And it will be available with the next release (version > 4.2.2).

However, for your question about the src folder. In general, authors (like us) might publish the source code in the package in order to want to allow users to see the original TypeScript source code, for example, for debugging purposes or if they wish to transpile the code themselves with different settings.

I will close this issue as resolved. However, if you installed the last web3@dev version but you continue to face it, please open the issue again. And possibly provide a full simple project example to reproduce this issue on our machines. Or provide the code at some cloud IDE like https://codesandbox.io/.

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

2 participants