Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Fix prod tsconfig and include ethjs-util types in dist #260

Merged
merged 3 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference path="./@types/ethjs-util/index.ts"/>
Copy link
Member

@alcuadrado alcuadrado Jul 6, 2020

Choose a reason for hiding this comment

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

I think you can just do an import "./@types/ethjs-util/index.ts"; here. I'm not sure if this triple-slash reference would work after compilation, as that index.ts won't exist in the build.

Copy link
Contributor Author

@cgewecke cgewecke Jul 6, 2020

Choose a reason for hiding this comment

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

@alcuadrado

Yeah this is weird but tsc auto-generates the contents of the @types folder in the dist creating a .d.ts file.

dist/
  @types/
    ethjs-util/
      index.d.ts
      index.js
      index.js.map

And it rewrites the triple slash reference in the dist's main index.d.ts like this:

/// <reference path="@types/ethjs-util/index.d.ts" />

Copy link
Member

Choose a reason for hiding this comment

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

🤯

/**
* Constants
*/
Expand Down
6 changes: 0 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"extends": "@ethereumjs/config-tsc",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["src/@types/*"]
}
},
"include": ["src/**/*.ts", "test/**/*.ts"]
}
3 changes: 2 additions & 1 deletion tsconfig.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
}
},
"include": ["src/**/*.ts"]
}