Skip to content

feat: Add typings to npm package #693

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

Merged
merged 2 commits into from
Apr 29, 2025
Merged

feat: Add typings to npm package #693

merged 2 commits into from
Apr 29, 2025

Conversation

roninjin10
Copy link
Contributor

  • add .d.ts files to final build with declaration: true in tsconfig
  • include .d.ts file in final tarball

This was referenced May 28, 2023
@coveralls
Copy link

Coverage Status

Coverage: 84.537%. Remained the same when pulling 0ede118 on roninjin10:master into 9f3d555 on ethereum:master.

@CoolColdUK
Copy link

CoolColdUK commented Jul 16, 2023

maybe need types in package.json as well?
image
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

@yiyi-wang-rv
Copy link

yiyi-wang-rv commented Sep 11, 2023

Any update to this PR? 👀

@roninjin10
Copy link
Contributor Author

Happy to help land this pr if any changes are requested

@OmarTawfik
Copy link

Thank you for working on this. We are also running into this issue.

cc @r0qs for code review if you don't mind.

Copy link
Member

@r0qs r0qs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @roninjin10, and sorry for the very late reply, let's do this. Could you please just add the following:

--- i/package.json
+++ w/package.json
@@ -3,6 +3,7 @@
   "version": "0.8.28",
   "description": "Solidity compiler",
   "main": "index.js",
+  "types": "index.d.ts",
   "bin": {
     "solcjs": "solc.js"
   },

However, please note that this will not fully expose all types, as there is still some missing support that needs to be implemented: #615. Nevertheless, it is a step in the right direction, and I believe there is no harm in taking this as a first step.

@coveralls
Copy link

coveralls commented Mar 16, 2025

Coverage Status

coverage: 84.537%. remained the same
when pulling a00d098 on roninjin10:master
into d79333a on ethereum:master.

@roninjin10
Copy link
Contributor Author

I got some types here that I have been using past couple years for Tevm. Anyone is free to copy

https://github.com/evmts/tevm-monorepo/blob/main/bundler-packages/solc/src/solcTypes.ts

@roninjin10
Copy link
Contributor Author

@r0qs I did your change happy to rebase or do any other changes you need

@r0qs
Copy link
Member

r0qs commented Mar 21, 2025

@r0qs I did your change happy to rebase or do any other changes you need

Yes, could you please squash and rebase. :)

@roninjin10
Copy link
Contributor Author

@r0qs I did your change happy to rebase or do any other changes you need

Yes, could you please squash and rebase. :)

Fresh rebase

@roninjin10 roninjin10 requested a review from r0qs April 22, 2025 21:25
@@ -3,6 +3,7 @@
"version": "0.8.29",
"description": "Solidity compiler",
"main": "index.js",
"types": "index.d.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would normally also want exports array. Also sideEffect: false to enable tree shaking. Happy to follow up with a new pr cleaning this stuff up. They aren't critical but help provide universal compatibility to all tools

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yes, that would be great :)

@r0qs r0qs merged commit f9fa055 into ethereum:master Apr 29, 2025
14 checks passed
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

Successfully merging this pull request may close these issues.

6 participants