-
Notifications
You must be signed in to change notification settings - Fork 119
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
typscript 4.2.4 multiple errors "error TS2304: Cannot find name 'Request'" #201
Comments
Setting the following in my {
"target": "es2018",
"lib": ["DOM"]
}, |
@cwoolum This is a server-side code, executes on Node.js. It should not have "DOM" lib instantiated, or there will be other bugs. "DOM" lib is only for browser clients target only. |
While the library is a server side library, the fetch API is one that's defined in the dom types. Technically I could add a:
to our index.d.ts but that technically just imports the "dom" library types. So as stated, adding "DOM" to the lib in tsconfig does the same thing. You should probably have two separate tsconfig files, one for testing and one for building. The testing one should have the lib reference and the building one should not. |
@yinzara Thank you for response!
One more thing - we are not using |
I'm working on updating some parts of an API, and tests as part of an API with typescript version 4.
I'm running
tsc --noEmit
without --skipLibCheck flag, and I see multiple typescript errors in logs.I have found that this error is possibly related to
Request
type coming from typescript browserdom
library, which is missing in node.js projects, hence causing the missing type.I found similar issues in github: meilisearch/meilisearch-js#661
The text was updated successfully, but these errors were encountered: