Minor version 2.2 is breaking for TypeScript consumers
See original GitHub issuehttps://github.com/sourcegraph/javascript-typescript-langserver/issues/371 https://travis-ci.org/sourcegraph/javascript-typescript-langserver/jobs/289329597#L1487-L1490
src/logging.ts(72,40): error TS2339: Property 'grey' does not exist on type 'typeof "/home/travis/build/sourcegraph/javascript-typescript-langserver/node_modules/chalk/types/...'.
src/logging.ts(80,40): error TS2339: Property 'bgCyan' does not exist on type 'typeof "/home/travis/build/sourcegraph/javascript-typescript-langserver/node_modules/chalk/types/...'.
src/logging.ts(88,40): error TS2339: Property 'bgYellow' does not exist on type 'typeof "/home/travis/build/sourcegraph/javascript-typescript-langserver/node_modules/chalk/types/...'.
src/logging.ts(96,40): error TS2339: Property 'bgRed' does not exist on type 'typeof "/home/travis/build/sourcegraph/javascript-typescript-langserver/node_modules/chalk/types/...'.
Before 2.2, with @types/chalk
, it was possible to import chalk like this:
2.2 brings its own types, which override @types/chalk
, but they don’t allow this import (only a defaut import):
https://github.com/chalk/chalk/blob/d86db88e778fa856f4d6f5f68c588750ca06b822/types/index.d.ts#L90
Although it seems to work at runtime and appears semantically correct / correct in regard to the JS:
https://github.com/chalk/chalk/blob/d86db88e778fa856f4d6f5f68c588750ca06b822/index.js#L219
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:41 (19 by maintainers)
Top Results From Across the Web
Documentation - TypeScript 3.9
The function's types declare that it takes two string s so that other TypeScript users can get type-checking errors, but it also does...
Read more >node.js - How to relate a version of @types to ... - Stack Overflow
Because the minor version shouldn't represent breaking changes, in theory, you can use the highest 2.x.y definition file available for a 2.a.b.c ...
Read more >About semantic versioning - npm Docs
Backward compatible new features, Minor release, Increment the middle digit and reset last digit to zero, 1.1.0. Changes that break backward compatibility ...
Read more >Firebase Admin Node.js SDK Release Notes - Google
Breaking change: Dropped support for Node.js 12. Developers should use Node.js 14 or higher when deploying the Admin SDK. Breaking change: Upgraded TypeScript...
Read more >Changelog - Cypress Documentation
Breaking Changes: Cypress dropped support for Node.js 12, 15 and 17. Those versions have reached end-of-life. Installing Cypress on your system ...
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
Obligatory XKCD:
@sindresorhus thanks for Chalk and your other contributions!
You may not appreciate it, and I know you didn’t author it, but
@types/chalk
for all intents and purposes was the “official” Chalk API for TypeScript users. Creating anindex.d.ts
that differs from that API is a breaking change, by definition. The other commenters on this issue are evidence to this effect.Also, I’ve used upwards of 100 typed packages over the past year, and this typing is the first to require a non-namespaced
import chalk from "chalk"
style. I’d expect a good deal of issues or questions to arise from this.For other people wondering why chalk broke for them with a minor release, as stated above, change
to