slash
slash copied to clipboard
feat(@toss/utils): Add `ElementType` import from `@toss/utility-types`
Overview
Change import path local to @toss/utility-types
Because this is likely to be a dualization of management.
PR Checklist
- [x] I read and included theses actions below
- I have read the Contributing Guide
- I have written documents and tests, if needed.
Deploy request for slash-libraries pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | add00be58605b22ee51cde305e3371fb9543ed77 |
This is redundant:)
It could be a waste for people who don't use typescript!
ref https://github.com/toss/slash/pull/152#discussion_r1027409782
Thank you for your kind explanation.
It could be a waste for people who don't use typescript!
I think this is different between dependencies and devdependencies.
I use @toss/utility-types for devdependencies that is not installed for other users (who install @toss/utils)
For example, if you install @toss/react that have typescript package in devdependencies.
But users node_modules is installed without typescript package includes any devdependencies in @toss/react.
reference. whats-the-difference-between-dependencies-devdependencies-and-peerdependencie
Actually, when using ElementType from @toss/utility-types, we should use it as a regular dependency (not a devDependency). Otherwise, the returned type from pick or omit would not be inferred.
(Because pick returns Pick<ObjectType, ElementType<KeyTypes>>, and unless we install @toss/utility-types, the definition of ElementType is missing...)
This is a very tricky situation.
and unless we install @toss/utility-types, the definition of ElementType is missing...)
Oh,,, I missed of the impact of an installed package on another package.
It seems that @toss/utils already provides a function of typed utility. (e.g pick, omit, object-values etc..)
My solution is to add more util types used in utils packages like ObjectKeys to @toss/utility-types, and update devdependencies to dependencies
I think it's the difference between providing a lighter package to the user or guaranteeing the maintenance of the @toss/slash package.
Adding "@toss/utily-types" to the dependencies is acceptable since it doesn't increase the size of the runtime bundle where it's utilized, despite potentially increasing the size of "@tossteam/utils" when fetched from npm.
Adding "@toss/utily-types" to the dependencies is acceptable since it doesn't increase the size of the runtime bundle where it's utilized, despite potentially increasing the size of "@tossteam/utils" when fetched from npm.
Thank you for your kind explanation.
I have finished changing from devDependencies to dependencies. chore: add @toss/utility-types to dependencies
Closing this pull request since this became stale. But we picked this change in the following commit: https://github.com/toss/slash/commit/063821639b8680bb1d0348306f43d26fb004a192. Thanks for your contribution!