-
Notifications
You must be signed in to change notification settings - Fork 132
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
Refactor core package to use Node types #2221
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EltonGohJH
approved these changes
Mar 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
jovyntls
force-pushed
the
ts-unify-node-types
branch
from
March 18, 2023 04:22
2e15a42
to
59e046a
Compare
raysonkoh
reviewed
Mar 18, 2023
jovyntls
force-pushed
the
ts-unify-node-types
branch
from
March 20, 2023 06:09
59e046a
to
2c3a3fb
Compare
raysonkoh
approved these changes
Mar 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
yucheng11122017
pushed a commit
to yucheng11122017/markbind
that referenced
this pull request
Mar 22, 2023
Refactor core package to use Node types In MarkBind#2201, we introduced a unifying type for nodes. Most of the core package is not yet using the new types. Let's refactor the core package to utilise these new types, and add a utility parseHTML method that avoids further `as unknown as` typecasts throughout the codebase. Doing so allows us to make full use of TypeScript's type-checking abilities while avoiding code duplication. For more information on the rationale of the unifying types, refer to MarkBind#2201.
ong6
pushed a commit
to ong6/markbind
that referenced
this pull request
Mar 23, 2023
Refactor core package to use Node types In MarkBind#2201, we introduced a unifying type for nodes. Most of the core package is not yet using the new types. Let's refactor the core package to utilise these new types, and add a utility parseHTML method that avoids further `as unknown as` typecasts throughout the codebase. Doing so allows us to make full use of TypeScript's type-checking abilities while avoiding code duplication. For more information on the rationale of the unifying types, refer to MarkBind#2201.
11 tasks
tlylt
pushed a commit
that referenced
this pull request
Mar 31, 2023
Clean up & standardise TypeScript conventions The core package is almost fully migrated to TypeScript. There are several inconsistencies and redundancies in how we represent common types, handle typecasts, and export/import files. These inconsistencies may cause confusion, reduce code quality, and prevent us from fully taking advantage of static typing. As of #2201 and #2221, we have a more mature typing system that we can utilise to fix these inconsistencies as well as a general set of conventions that can be followed across TS files. Let's, - Standardise class exports - Standardise key-value types to use `Record<K, V>` - Remove unnecessary `as unknown as` typecasts - Reduce the use of `any` types - Fix outdated docs that refer to `.js` files Using Record is preferable as `Record<K,V>` is interchangeable with `{ [key: K]: V }` syntax, but is more extensible and arguably more readable. `unknown` and `any` types also introduce uncertainty and unsafe typecasts into the codebase.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
Implements #2114 on the rest of the core package
Overview of changes:
parseHTML
utility method. Wrappingcheerio.parseHTML
allows us to avoid furtheras unknown as
typecasts throughout the codebase.Anything you'd like to highlight/discuss:
N/A
Testing instructions:
Should have no changes in behaviour
Proposed commit message: (wrap lines at 72 characters)
Checklist: ☑️