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 Parser and Compiler types #64

Merged
merged 2 commits into from
Jul 17, 2019
Merged

Fix Parser and Compiler types #64

merged 2 commits into from
Jul 17, 2019

Conversation

clavin
Copy link
Contributor

@clavin clavin commented Jul 16, 2019

The current typings are defined such that Parsers and Compilers (and their respective functional variants) take VFileCompatible arguments (and, in the case of Parsers, has the wrong number of arguments). The truth is the spec states that they should accept VFile objects (and Parsers take two arguments), and the underlying implementation aligns with this:

Looking for the same inconsistency in the typings, I checked other occurrences of VFileCompatible in the index.d.ts file. The remaining occurrences align with the spec--that is, anywhere VFileCompatible shows up in the typings, the spec explicitly states "any value accepted by vfile()".

@codecov-io

This comment has been minimized.

@ChristianMurphy ChristianMurphy requested a review from a team July 16, 2019 22:53
@ChristianMurphy
Copy link
Member

/cc @Rokt33r

Copy link
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

Thanks @clavin!
A couple questions on the changes below.

types/index.d.ts Outdated Show resolved Hide resolved
types/index.d.ts Outdated Show resolved Hide resolved
types/index.d.ts Show resolved Hide resolved
types/index.d.ts Show resolved Hide resolved
@clavin
Copy link
Contributor Author

clavin commented Jul 17, 2019

Oh! 😳Nice catch on the object methods. Those should be patched up 👍

I also noticed that the Parser and Compiler types were defined as classes (which they aren't--you cant define a class that extends some Compiler value defined in unified) so I swapped them over to more appropriate interfaces 😊.

Copy link
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @clavin!

Copy link
Member

@Rokt33r Rokt33r left a comment

Choose a reason for hiding this comment

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

LGTM! 👍 👍

@ChristianMurphy
Copy link
Member

@wooorm these are fixes and can go in a patch release.

@wooorm wooorm merged commit 6d4c01c into unifiedjs:master Jul 17, 2019
@clavin clavin deleted the fix-parser-compiler-types branch July 17, 2019 23:50
wooorm pushed a commit to remarkjs/remark that referenced this pull request Jul 20, 2019
Related to unifiedjs/unified#53.
Related to unifiedjs/unified#54.
Related to unifiedjs/unified#56.
Related to unifiedjs/unified#57.
Related to unifiedjs/unified#58.
Related to unifiedjs/unified#59.
Related to unifiedjs/unified#60.
Related to unifiedjs/unified#61.
Related to unifiedjs/unified#62.
Related to unifiedjs/unified#63.
Related to unifiedjs/unified#64.
Related to #426.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
Reviewed-by: Junyoung Choi <fluke8259@gmail.com>
Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>

Co-authored-by: Junyoung Choi <fluke8259@gmail.com>
Co-authored-by: Christian Murphy <christian.murphy.42@gmail.com>
@wooorm wooorm added ☂️ area/types This affects typings ⛵️ status/released 🐛 type/bug This is a problem 👶 semver/patch This is a backwards-compatible fix labels Aug 10, 2019
@wooorm wooorm added the 💪 phase/solved Post is done label May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☂️ area/types This affects typings 💪 phase/solved Post is done 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem
Development

Successfully merging this pull request may close these issues.

5 participants