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

error TS2694: Namespace 'request' has no exported member 'Response'. #23341

Closed
saisnigdhap opened this issue Feb 1, 2018 · 15 comments
Closed

Comments

@saisnigdhap
Copy link

Hi,
Getting the below exception with npm package @types/request-promise-native version 1.0.12, issue is not reproducible for previous versions. Could anyone look into this asap.
node_modules/@types/request-promise-native/index.d.ts(20,49): error TS2694: Namespace 'request' has no exported member 'Response'.
node_modules/@types/request-promise-native/index.d.ts(24,33): error TS2694: Namespace 'request' has no exported member 'Response'.

Got the below code that is causing the error:

transform?(body: any, response: request.Response, resolveWithFullResponse?: boolean): any;

Thanks.

vsund added a commit to ntzwrk/sks-lib that referenced this issue Feb 2, 2018
@mastermatt
Copy link
Contributor

Make sure @types/request gets updated >= 2.47.0 when you update @types/request-promise-native. The two libs were updated with #23004.

@saisnigdha93
Copy link

Thank you, this worked.

@jwhitmarsh
Copy link

I'm having the same issue with @types/request-promise@4.1.41. I've installed @types/request@2.47.0 but it looks like it's still depending on the nested @types/request (/node_modules/@types/request-promise/node_modules/@types/request/index.d.ts) rather than the version I've installed.

Is this an issue with my config, or with the package?

@mastermatt
Copy link
Contributor

@jwhitmarsh @types adds other @types as dependancies using "@types/request": "*".
So how you update your decencies makes a difference.
Just running npm install @types/request@2.47.0 will not do the job. I'm away from my comp atm, so I can't test if npm update is all you need to run after setting @types/request-promise to a new version in your package.json. Give that a try, of course just deleting node_modules and npm install is an (probably overkill) option.

That being said, @saisnigdha93 or some core dev can close this issue now.

@jwhitmarsh
Copy link

@mastermatt thank you! I've never come across having to use npm update after an npm install before.

@mastermatt
Copy link
Contributor

@jwhitmarsh did you already have @types/request installed by chance? I'm curious if it had to do with reusing a cached version.
Sorry for the extra work, I don't think it's possible in @types to declare a minimum version for other @types, as Microsoft/types-publisher will error if you try to add one to a package.json.

@jwhitmarsh
Copy link

I'm not sure that'd I'd never had it installed before. It was newly added to that project, but I might have used it before in another project which presumably will have set the cache - your theory sounds plausible, I'm sorry I can't help confirm it :(

No apology necessary at all - very grateful for your help resolving it.

@dotansimha
Copy link

Same here. adding @types/request causes it to duplicate and the tsc throws errors regarding duplicate symbols.

@mastermatt
Copy link
Contributor

@dotansimha you shouldn't need to add @types/request explicitly, however, it seems you need to double check which version npm has installed under @types/request-promise-native.
From the comments above, it looks like npm update does the trick.

@dotansimha
Copy link

@mastermatt
I tried to clean all node_modules in my project, clear Yarn cache, and then reinstall the dependencies.
My package.json specify "@types/request-promise-native": "1.0.14",, without @types/request.

Under node_modules/@types/, I have now @types/request-promise-native v1.0.14, and @types/request v2.0.9 (both in root, same depth level).

Still getting:

node_modules/@types/request-promise-native/index.d.ts(20,49): error TS2694: Namespace 'request' has no exported member 'Response'.
node_modules/@types/request-promise-native/index.d.ts(25,33): error TS2694: Namespace 'request' has no exported member 'Response'.

@NerijusV
Copy link

NerijusV commented Apr 3, 2018

I have sold this issue adding earlier version of @types/request-promise

npm install --save-dev @types/request-promise@^3.0.32

Hope it helps.

@sdeprez
Copy link

sdeprez commented Dec 11, 2018

Same than @dotansimha, the only fix was to downgrade yarn add @types/request-promise-native@0.9 --dev

@unnieayilliath
Copy link

@NerijusV thanks downgrading solved my issue too ! This is crazy

@nadavye
Copy link

nadavye commented Apr 24, 2019

Any update on this one?

@orta
Copy link
Collaborator

orta commented Jun 7, 2021

Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types modules in DefinitelyTyped.

To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed channel.

@orta orta closed this as completed Jun 7, 2021
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

No branches or pull requests

10 participants