You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bcoin-org and handshake-org dependencies actively use JSDocs to document types in the codebase. Unfortunately, they don't provide anything more useful than the documentation, they are not used for the type checking. In the end documentation sometimes becomes incorrect and goes out of sync and there's no easy way to detect those.
TypeScript support for the JSdoc but with several differences. It can allow us to check the code for the proper types and detect when either types go out of sync. It can also help with code analyses in some cases and catch when something does not have proper type etc. It is not all powerful but is an improvement over what we have.
In general, bcoin-org/handshake-org projects don't want to introduce dependencies to the projects if possible and especially not the another step in development process (e.g. transpiling). But what we can use are external tools to verify the code quality (linter).
This is a proposal to use tsc externally as a type linter, but don't use it for anything more. Developers don't have any strict requirement to install them locally (similar to linter) and can just rely on the CI to lint them.
This change was inspired by the svelte: sveltejs/svelte#8569
Relationship with jsdoc reference
Some syntax in TypeScript is not supported by the jsdoc reference generator, for that purpose we can remove them in the jsdoc reference generator.
Here's a fix for the typedef imports: pinheadmz/bsdoc#1
There are already several PRs that have these changes, but are not merged yet to allow for the feedback. Here's the short list of them (Some of them have linter on ci failing, because dependencies are not published)
Goal is not to fully fix everything in one go, but to allow slow incremental improvements. Current list of PRs do mostly minimal work to suppress or fix types in the dependencies. Slowly we can iterate and fix these.
Handshake and bcoin both can enable type lints slowly starting from simpler modules (e.g. primitives) and slowly expand the tsc-lint support everywhere.
Here's the list of current PRs:
Motivation
bcoin-org and handshake-org dependencies actively use JSDocs to document types in the codebase. Unfortunately, they don't provide anything more useful than the documentation, they are not used for the type checking. In the end documentation sometimes becomes incorrect and goes out of sync and there's no easy way to detect those.
TypeScript support for the JSdoc but with several differences. It can allow us to check the code for the proper types and detect when either types go out of sync. It can also help with code analyses in some cases and catch when something does not have proper type etc. It is not all powerful but is an improvement over what we have.
In general, bcoin-org/handshake-org projects don't want to introduce dependencies to the projects if possible and especially not the another step in development process (e.g. transpiling). But what we can use are external tools to verify the code quality (linter).
This is a proposal to use tsc externally as a type linter, but don't use it for anything more. Developers don't have any strict requirement to install them locally (similar to linter) and can just rely on the CI to lint them.
This change was inspired by the svelte: sveltejs/svelte#8569
Relationship with jsdoc reference
Some syntax in TypeScript is not supported by the jsdoc reference generator, for that purpose we can remove them in the jsdoc reference generator.
Here's a fix for the typedef imports: pinheadmz/bsdoc#1
Implementation
TypeScript needs types for the builtin nodejs types which are not built into it. This in general is provided by: https://github.com/DefinitelyTyped/DefinitelyTyped To avoid extra dependencies to the project the necessary type aliases are
vendored here: https://github.com/bcoin-org/bts-type-deps
There are already several PRs that have these changes, but are not merged yet to allow for the feedback. Here's the short list of them (Some of them have linter on ci failing, because dependencies are not published)
Goal is not to fully fix everything in one go, but to allow slow incremental improvements. Current list of PRs do mostly minimal work to suppress or fix types in the dependencies. Slowly we can iterate and fix these.
Handshake and bcoin both can enable type lints slowly starting from simpler modules (e.g. primitives) and slowly expand the tsc-lint support everywhere.
Here's the list of current PRs:
The text was updated successfully, but these errors were encountered: