v3.0.10 contains breaking changes from v3.0.9
See original GitHub issueThe version v3.0.10
added a string & {}
to types that didn’t supported string
making it a breaking change from v3.0.9
:
import type { Property } from 'csstype';
// Fails in 3.0.9 but works in 3.0.10
const fontWeight: Property.FontWeight = 'anything'; // ok 'anything' is a string & {}
console.log(fontWeight)
This difference makes TS fail when NPM resolves to different (but semver compatible) versions of csstype:
import styled from 'styled-components'; // npm resolves to 3.0.9
import otherLibProps from 'other'; // npm resolves to 3.0.10
const Component = styled.div`
/* fails string & {} is not assignable to fontWeight in 3.0.9 */
${otherLibProps}
`
While the previous situation is a red flag about NPM hoisting issues, it’s a possible situation that I’ve seen in repos with dependencies that internally use older csstype versions (like material-ui v4).
Possible solutions:
- The addition of
string & {}
tofontWeight
was an error, because it makes the type more permissive and not assignable to type declarations of previous versions. Removingstring & {}
in that case should be harmless as it doesn’t affect the TS LSP auto-complete. This will not fix #125 in 3.x. - Keep the
string & {}
but mark the version as v4.0.0: it will not solve the TS compilation issues, but at least the incompatibility is explicit and libraries using^3.
in the semver range will not catch the issue by surprise. This fixes #125 but in a 4.x version.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:10 (1 by maintainers)
Top Results From Across the Web
v3.0.10 breaks specificity when used with Vue scoped style
After more experimentation it seems this occurs whenever I have <style lang="scss" scoped> in the component or component's parent. Very strange.
Read more >Migrating between versions - Great Expectations!
The 0.11.0 release has several breaking changes related to run_id and ValidationMetric objects. Existing projects that have Expectation Suite Validation ...
Read more >Releases - 0.10.0 - Clarity Design System
0.10.0 Changelog ... Below are the list of components with breaking changes. If you have been upgrading with alpha versions, you are already...
Read more >Changelog | Meteor API Docs
Patch release to update Node to version 14.19.3 and npm version to 6.14.17. Breaking Changes. N/A. Migration Steps. N/A ...
Read more >Changelog — hvac 1.0.2 documentation
Remove redundant code for Python <= 3.5. GH-822. Drop Python 2 and EOL Python 3 versions. ... Retained argument position to prevent being...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@villasv I agree with you about SemVer. The definition of “breaking change” is vague, and the use of typings wasn’t even a use case of Node dependency handling.
However, type widening may break a previous contract:
This scenario may happen if:
To me is about expectations: when you upgrade to a patch version, a CI compilation failure is unexpected.
My situation was exactly like that: I maintain a design system that uses csstype. I did an upgrade from
3.0.9
to3.0.10
. Patch upgrade. Everything is good. All tests passing.Suddenly, I received notifications from other teams using the library: the CI compile step failed. The reason: their project use styled-components and consume values from the design system. A tagged literal is a function call:
And unless you declare csstype as a peer-dependency, there is no guarantee that the package manager will not duplicate versions.
In a situation like this, v4 in the version number is a good indicator of what to expect. As a project maintainer, I know it’s hard to identify breaking changes. I wonder if we can reify the notion of “breaking change” with unit tests.
@dfernandez79 thank you! I was getting close to figuring out what was going on but not sure I would have got there if I didn’t find this issue report.
finally resolved after a long day of head-scratching with resolutions for yarn 3 added to main package.lock.
I was just trying to move a bunch of [mui@4] React components from an old working repo to a new monorepo. Even copying all deps and versions from the old repo didn’t avoid this issue of course and it was very unclear as to where the problem lay so I spent a lot of time looking at all the wrong things.