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

Add support for tag name inferral in types #6

Merged
merged 1 commit into from
May 9, 2021
Merged

Conversation

wooorm
Copy link
Member

@wooorm wooorm commented May 8, 2021

Closes GH-5.

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

See GH-5.

Notes:

  • I’m not 100% about type versions. I never used it before. And I wasn’t able to test it. Does this work?
  • I couldn’t get parse(null) to return a normal element, or parse(undefined, 'g') to return a g
  • Any other tips are more than welcome!

@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label May 8, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm added the 👍 phase/yes Post is accepted and can be worked on label May 8, 2021
@github-actions github-actions bot removed the 👋 phase/new Post is being triaged automatically label May 8, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm added ☂️ area/types This affects typings 🦋 type/enhancement This is great to have 🧒 semver/minor This is backwards-compatible change labels May 8, 2021
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.

Very cool 🤩
A nice addition 🌟

LGTM

@wooorm
Copy link
Member Author

wooorm commented May 9, 2021

@ChristianMurphy You think

"typesVersions": {
is going to work? I’m not sure how to assert that it does

@ChristianMurphy
Copy link
Member

It looks like it does https://github.com/unifiedjs/unified/blob/0f3b92833fd910c21edef423ad5891af7f11a82e/package.json#L39-L46 uses similar syntax.
For testing, I usually pull the code up in VSCode, view the tests/type tests, and switch the typescript version from the menu to see how it responds.
And if that doesn't cut the mustard, I'd symlink with npm link into another project, and do the same process.

@wooorm
Copy link
Member Author

wooorm commented May 9, 2021

It looks like it does unifiedjs/unified@0f3b928/package.json#L39-L46 uses similar syntax.

Yeah, that’s what I went for. Plus I searched and found that there was an inverted syntax (<=) too.


I’ll see if downgrading TS still runs!

@wooorm
Copy link
Member Author

wooorm commented May 9, 2021

Blargh. No. Doesn’t seem to work

@wooorm
Copy link
Member Author

wooorm commented May 9, 2021

nvm, it worked fine!

@wooorm wooorm merged commit ca35b5a into main May 9, 2021
@wooorm wooorm deleted the tag-name-inferral branch May 9, 2021 18:49
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label May 9, 2021
@github-actions github-actions bot removed the 👍 phase/yes Post is accepted and can be worked on label May 9, 2021
@wooorm
Copy link
Member Author

wooorm commented May 9, 2021

Released in 3.1.0!

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/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

Successfully merging this pull request may close these issues.

Add support for extracting the tag name in types
2 participants