-
-
Notifications
You must be signed in to change notification settings - Fork 8
Import types from mdast or add @types/unist to devDeps #14
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
Comments
I'm confused how
This is similar to syntax-tree/unist-util-filter#4 We've avoided adding direct dependencies on |
Hum I see, my package has @types/unist already in devDeps. Yarn2 really expects every package specifying deps specifically itself tho. |
Yarn 2 checks the typings during the install phase? Is that expected? Also note that Yarn 2 is still a pre-release there may be some bugs/instability. |
/cc @Rokt33r |
You're right it doesn't, that happened because of a Yea I know about pre-release, yet they mention the explicit dependency resolution everywhere so I doubt that'll change 🤷♂️ Forgot to link to https://yarnpkg.com/advanced/migration#a-package-is-trying-to-access-another-package- packageExtensions:
'unist-util-is@*':
dependencies:
'@types/unist': '*' That seems to work |
Interesting, based off how that works. Which could be a lot when we get to the high level packages like remark/rehype/retext presets, which include many plugins, which include many utils, each of which will need to be patched. It feels like a bad developer experience because it both takes patching, and the patching would need to happen at the nested/transitive dependency level, meaning devs need to dive deep into internals to get simple presets to work. |
Maybe we could re-add the dependencies, and document something like using https://github.com/gcanti/unknown-ts for systems that need to use unsupported Typescript versions? |
The issue I had was due to the (non-dev) dependency on |
I agree with @damonmaria. For non-TypeScript users, I think generally it better not to add extra dependencies. I assume that the need of the addition of some dependencies such as |
Hmmm, that makes |
@ChristianMurphy |
I’m up for going with whatever is common sense in TS-world, but I personally don’t like the caveats of https://docs.npmjs.com/files/package.json#peerdependencies.
|
I understand this perspective, depDependencies is going to be problematic with Yarn 2.
Because we are using devDependencies, It would be good to get ahead of this.
Some packages do include
These differences in handling peer dependencies are mostly between NPM versions, or differences between Yarn and NPM? |
Seems like everyone will have this problem with Yarn 2 in the TS world. In these cases I would typically wait a bit to see what others are doing. (Maybe that’s already being figured out!)
Pt. 1 and 2 are based on npm docs. I believe npm also does pt. 3 (but may warn about it). Pt. 3 and 4 are based on yarn docs, so may be different. By the way, as an aside, it’s interesting how engines and peers come up a lot recently, I see similarities between them |
@ChristianMurphy Any news on what the teams at your company / the world decided to do? How did it go? |
Most teams are on or have migrated back to
Checking FB open source, probably the largest user of |
That sounds bleak for yarn! |
Closing because this thread does not seem to warrant changes to this project. |
I think those types should probably be imported from 'mdast'
https://github.com/syntax-tree/unist-util-is/blob/master/index.d.ts#L3
Or as mentioned in the title @types/unist needs to be added to the dependencies
I'm trying to update to Yarn2 and this popped up
../../.yarn/cache/unist-util-is-npm-4.0.1-2754fc9f60-1.zip/node_modules/unist-util-is/index.d.ts(3,28): error TS2307: Cannot find module 'unist'.
and as Yarn2 is really specific about deps my only guess right now is this issue 😁
(edited by @wooorm to refactor formatting)
The text was updated successfully, but these errors were encountered: