got: got 12.4.1 dependency cacheable-request does not transpile
Describe the bug
Running TypeScript 4.8.2: Many errors generated on build of form node_modules/@types/cacheable-request/index.d.ts:118:60 - error TS2709: Cannot use namespace ‘ResponseLike’ as a type.
npm explain latest-version
cacheable-request@7.0.2 dev
node_modules/cacheable-request
cacheable-request@“^7.0.2” from got@12.4.1
node_modules/got
got@“^12.1.0” from package-json@8.1.0
node_modules/package-json
package-json@“^8.1.0” from latest-version@7.0.0
node_modules/latest-version
dev latest-version@“^7.0.0” from the root project
Problem remediated with:
"overrides": {
"latest-version": {
"got": "12.3.1"
}
}
and installing with
npm ci
if installing with yarn, use --frozen-lockfile as noted by proton-ab below.
Checklist
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 23 (6 by maintainers)
Commits related to this issue
- chore: Pin transitive `got` dependency to 12.3.1 Due to https://github.com/sindresorhus/got/issues/2129 Also pin the `@types/responselike` dependency to 1.0.0. Some transitive deps are pinned to ens... — committed to fabscale/ember-graphql-client by mydea 2 years ago
- fix: pin version of got and @types/responselike Reason: https://github.com/sindresorhus/got/issues/2129 — committed to projen/projen by mrgrain 2 years ago
- functions: Fix compilation error TS2709: Cannot use namespace 'ResponseLike' as a type. ref: https://github.com/sindresorhus/got/issues/2129 — committed to KuSh/TwitchJambionnat by KuSh 2 years ago
- Set explicit version of 'got' due to due to invalid Newer version of 'got' (which is brought in by 'npm-check-updates') depends on an outdated "@types/cacheable-requests" More info: https://github.c... — committed to BastianBlokland/typedtree-editor by BastianBlokland 2 years ago
- chore: Pin transitive `got` dependency to 12.3.1 Due to https://github.com/sindresorhus/got/issues/2129 Also pin the `@types/responselike` dependency to 1.0.0. Some transitive deps are pinned to e... — committed to fabscale/ember-cognito-identity by mydea 2 years ago
- chore: remove package overrides for `got` and `@types/responselike` (#2164) Fixes: #2163 The underlying issue (https://github.com/sindresorhus/got/issues/2129) has been resolved and packages are aga... — committed to projen/projen by mrgrain 2 years ago
This is caused by https://github.com/sindresorhus/responselike/releases/tag/v3.0.0 which is breaking for https://github.com/jaredwray/cacheable-request due to removal of
@types/responselike
and renaming ofResponseLike
type toResponse
.@sindresorhus thanks for all the help on this and we have published
v10.0.0
of cacheable-request. Please let me know if you have any issues with it as there are some breaking changes.Release Notes for v9: https://github.com/jaredwray/cacheable-request/releases/tag/v9.0.0 Release Notes for v10: https://github.com/jaredwray/cacheable-request/releases/tag/v10.0.0
@sindresorhus Since you’re in this thread, I’ll take the opportunity to say: I really appreciate everything you’ve done for the community. A pleasure to interact at last.
Recommendation for everyone to pin
@types/responselike
for now.Unless using frozen lockfile, you WILL fetch stub
"@types/responselike": "3.0.0"
because thoughtfully folks at DefinitelyTyped decided for@types/cacheable-request
to depend on"@types/responselike": "*"
. This will break your application/package regardless of whether you updated or even installedgot
or not (but you are using--frozen-lockfile
on production, right?).Still facing error
Yep. Wasted an hour tracking this down. Hardcoded
"got": "12.3.0",
@sindresorhus have you plan to port this fix to got@11?
We have now updated
cacheable-request
to export types which we believe will help with the migration to latest. Next, we will be looking at building a pull request ingot
. FYIhttps://github.com/jaredwray/cacheable-request/releases/tag/v10.0.2
I plan to upgrade
cacheable-request
, which will fix problem, but they need to make a new release first.Ok, the DTS maintainers now have moved the
latest
tag back to@types/responselike@1.0.0
. Plz let me know if that fixes your problems.@BendingBender as of npm 8.3.0, I believe you can do the same thing with “overrides”.