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

Fix types warnings #123

Merged
merged 10 commits into from
May 16, 2022
Merged

Fix types warnings #123

merged 10 commits into from
May 16, 2022

Conversation

icepy
Copy link
Contributor

@icepy icepy commented May 15, 2022

Closes #121

typedoc default only exports from the direct entrypoints are included

i used this plugin.

https://github.com/Gerrit0/typedoc-plugin-missing-exports

@vercel
Copy link

vercel bot commented May 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
essential-eth ✅ Ready (Inspect) Visit Preview May 16, 2022 at 0:50AM (UTC)

@arimgibson arimgibson linked an issue May 15, 2022 that may be closed by this pull request
Copy link
Contributor

@arimgibson arimgibson left a comment

Choose a reason for hiding this comment

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

This looks great, thanks @icepy ! @dawsbot is ultimately in charge of approving and merging 😁

"entryPoints": ["src/index.ts"],
"json": "scripts/markdown-magic/typedoc.out.json",
"plugin": ["typedoc-plugin-missing-exports"]
}
Copy link
Contributor

@arimgibson arimgibson May 15, 2022

Choose a reason for hiding this comment

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

pretty option is enabled by default with typedoc, could be expressly defined though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's great!

@codecov
Copy link

codecov bot commented May 15, 2022

Codecov Report

Merging #123 (5081906) into master (42034bb) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 5081906 differs from pull request most recent head e190617. Consider uploading reports for the commit e190617 to get more accurate results

@@           Coverage Diff           @@
##           master     #123   +/-   ##
=======================================
  Coverage   85.58%   85.58%           
=======================================
  Files          37       37           
  Lines         888      888           
  Branches      258      258           
=======================================
  Hits          760      760           
  Misses        113      113           
  Partials       15       15           
Impacted Files Coverage Δ
src/providers/FallthroughProvider.ts 90.00% <ø> (ø)
src/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42034bb...e190617. Read the comment docs.

@dawsbot
Copy link
Owner

dawsbot commented May 15, 2022

This is not yet working with Docusaurus. You can tell because "RPCBlock" is not an anchor in the docusaurus site (https://essential-eth-git-fork-icepy-fix-types-warnings-earnifi.vercel.app/docs/api/modules)

Let's revisit this after hearing from the core team in Gerrit0/typedoc-plugin-missing-exports#13

@Gerrit0
Copy link

Gerrit0 commented May 16, 2022

While this does remove the warnings, it does not really address the reason that the warnings were there in the first place. If a user of this package wants to reference ConstructorOptions to construct an object and pass it to a few of their functions before creating a FallthroughProvider, they have a few choices:

  1. Import the type from the internal path, and hope it never changes: import { ConstructorOptions } from "essential-eth/lib/esm/providers/FallthroughProvider"
  2. Derive the type from the exported type: type ConstructorOptions = ConstructorParameters<typeof FallthroughProvider>[1]
  3. Copy the definition and manually keep it up to date when updating the library.

@dawsbot
Copy link
Owner

dawsbot commented May 16, 2022

Thank you for the explanation @Gerrit0 🙏

@@ -10,7 +10,7 @@ const promiseTimeout = (prom: Promise<any>, time: number) =>
),
]);

interface ConstructorOptions {
export interface ConstructorOptions {
Copy link
Contributor

Choose a reason for hiding this comment

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

@dawsbot I figured this type was worth exporting, but it can be ignored if not

@arimgibson
Copy link
Contributor

arimgibson commented May 16, 2022

@dawsbot take a look at my most recent commit when ya get a chance. I went through it manually; i.e. exported some of the missing types and ignored others that shouldn't be exported (used internally).

Couple things I found along the way worth mentioning to explain why I did what I did:

  • Using the @ignore tag before a type/function/etc that you are purposely not exporting will still throw a warning if that type/function/etc is referenced by something that is being exported
  • Same with @internal even with the --excludeInternal option set as true
  • intentionallyNotExported doesn't support glob or regex, hence having to add Transaction and Block as separate lines

@dawsbot
Copy link
Owner

dawsbot commented May 16, 2022

Great fixes @arimgibson! I'm having trouble running Docusaurus locally in this branch, but I see that on remote, this generates the docs just fine.

I'll debug locally and hopefully have this solved in just a few hours. Traveling today, so I'll be mostly offline ✈️

Here's my stack trace:

cd docusaurus && npm i && npm run start

SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/classes/internal_.BaseContract.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.BaseContract`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"hierarchy"}}>{`Hierarchy`}</h2>
  10 | <ul>
  11 | <li parentName="ul">
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/classes/internal_.BaseProvider.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.BaseProvider`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"hierarchy"}}>{`Hierarchy`}</h2>
  10 | <ul>
  11 | <li parentName="ul">
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/enums/internal_.Comparison.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.Comparison`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"enumeration-members"}}>{`Enumeration members`}</h2>
  10 | <h3 {...{"id":"eq"}}>{`EQ`}</h3>
  11 | <p>{``}<strong parentName="p">{`EQ`}</strong>{` = `}<inlineCode parentName="p">{`0`}</inlineCode></p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/enums/internal_.RoundingMode.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RoundingMode`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"enumeration-members"}}>{`Enumeration members`}</h2>
  10 | <h3 {...{"id":"rounddown"}}>{`RoundDown`}</h3>
  11 | <p>{``}<strong parentName="p">{`RoundDown`}</strong>{` = `}<inlineCode parentName="p">{`0`}</inlineCode></p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.ArrayLike.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.ArrayLike`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"type-parameters"}}>{`Type parameters`}</h2>
  10 | <table>
  11 | <thead parentName="table">
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.Big.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.Big`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"properties"}}>{`Properties`}</h2>
  10 | <h3 {...{"id":"c"}}>{`c`}</h3>
  11 | <p>{``}<strong parentName="p">{`c`}</strong>{`: `}<inlineCode parentName="p">{`number`}</inlineCode>{`[]`}</p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.BigConstructor.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.BigConstructor`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"callable"}}>{`Callable`}</h2>
  10 | <h3 {...{"id":"bigconstructor"}}>{`BigConstructor`}</h3>
  11 | <p>{``}<strong parentName="p">{`BigConstructor`}</strong>{`(`}<inlineCode parentName="p">{`value`}</inlineCode>{`): `}<a parentName="p" {...{"href":"/docs/api/namespaces/internal_#big"}}><inlineCode parentName="a">{`Big`}</inlineCode></a></p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.ConstructorOptions.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.ConstructorOptions`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"properties"}}>{`Properties`}</h2>
  10 | <h3 {...{"id":"timeoutduration"}}>{`timeoutDuration`}</h3>
  11 | <p>{``}<inlineCode parentName="p">{`Optional`}</inlineCode>{` `}<strong parentName="p">{`timeoutDuration`}</strong>{`: `}<inlineCode parentName="p">{`number`}</inlineCode></p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.RPCBlock.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RPCBlock`}</p>
     |                                                                               ^
   9 | <p>{`Exact response from backend`}</p>
  10 | <h2 {...{"id":"properties"}}>{`Properties`}</h2>
  11 | <h3 {...{"id":"basefeepergas"}}>{`baseFeePerGas`}</h3>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.RPCBlockTransaction.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RPCBlockTransaction`}</p>
     |                                                                               ^
   9 | <p>{`What JSONRPC responds with in getBlock transaction array`}</p>
  10 | <h2 {...{"id":"hierarchy"}}>{`Hierarchy`}</h2>
  11 | <ul>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.RPCLog.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RPCLog`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"properties"}}>{`Properties`}</h2>
  10 | <h3 {...{"id":"address"}}>{`address`}</h3>
  11 | <p>{``}<strong parentName="p">{`address`}</strong>{`: `}<inlineCode parentName="p">{`string`}</inlineCode></p>
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.RPCTransaction.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RPCTransaction`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"hierarchy"}}>{`Hierarchy`}</h2>
  10 | <ul>
  11 | <li parentName="ul">
SyntaxError: /Users/db/code/scratch/essential-eth/docusaurus/docs/api/interfaces/internal_.RPCTransactionReceipt.md: Expected corresponding JSX closing tag for <internal>. (8:78)
   6 |       components={components}>
   7 |
>  8 | <p><a parentName="p" {...{"href":"/docs/api/namespaces/internal_"}}><internal></a>{`.RPCTransactionReceipt`}</p>
     |                                                                               ^
   9 | <h2 {...{"id":"properties"}}>{`Properties`}</h2>
  10 | <h3 {...{"id":"blockhash"}}>{`blockHash`}</h3>
  11 | <p>{``}<strong parentName="p">{`blockHash`}</strong>{`: `}<inlineCode parentName="p">{`string`}</inlineCode></p>
client (webpack 5.71.0) compiled with 13 errors

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.

Export all forgotten types
4 participants