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

Move @types/* packages to dev dependencies #322

Merged
merged 1 commit into from
Jul 22, 2020
Merged

Conversation

vadimdemedes
Copy link
Owner

Fixes #320.

cc @G-Rath

package.json Show resolved Hide resolved
@@ -75,6 +64,17 @@
},
"devDependencies": {
"@sindresorhus/tsconfig": "0.7.0",
"@types/is-ci": "^2.0.0",
"@types/lodash.throttle": "^4.1.6",
Copy link
Collaborator

Choose a reason for hiding this comment

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

You cannot move all types. This type, for example, is used in the source code:

import throttle from 'lodash.throttle';

Copy link

@G-Rath G-Rath Jul 5, 2020

Choose a reason for hiding this comment

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

That is only used in the compiled js, not in the TypeScript definitions, so it's not required by this package at runtime nor at downstream compile time meaning it can be safely moved :)

Copy link
Owner Author

@vadimdemedes vadimdemedes Jul 5, 2020

Choose a reason for hiding this comment

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

Ok I think I'm confused now. What's a question I need to ask myself to determine when a @types/* dependency should be included in dependencies or devDependencies? My understanding was that this question is "Are types from @types/* package re-exported from my module in any way?".

Copy link

Choose a reason for hiding this comment

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

"Are types from @types/* package re-exported from my module in any way?".

That is the correct question to ask.

I'm not sure why @sindresorhus thinks this type is required in dependencies, since it fails the above question.

Copy link
Contributor

@SimenB SimenB Jul 5, 2020

Choose a reason for hiding this comment

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

You need to keep at least react, node, and yoga-layout (the latter seems to ship its own types)

image

node should probably be defined as *

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ok, In that case I think this PR is good to go as-is? None of the types from dependencies I've moved to devDependencies are exported from Ink.

Copy link
Contributor

Choose a reason for hiding this comment

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

See #322 (comment), you need at least node and react - possibly optional peer deps tho

Copy link
Owner Author

Choose a reason for hiding this comment

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

@SimenB @types/node should be a dev dependency, and maybe also an optional peer dependency, although I usually don't do that as it's expected that the user has that anyway if they use TypeScript.

I think comment by @sindresorhus makes sense to me, if developer is using TypeScript, they most likely already have (and should) @types/node and @types/react installed.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@milesj seems to share the same opinion on this too, sounds logical to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's how I do it for most of my stuff. But if you want to add them, just do * versions to not conflict with consumer versions.

@vadimdemedes
Copy link
Owner Author

Thanks everyone for feedback, very useful!

@vadimdemedes vadimdemedes merged commit 91b2afe into master Jul 22, 2020
@vadimdemedes vadimdemedes deleted the move-types branch July 22, 2020 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ink v3 contains @types packages as dependencies
5 participants