domain-task: TypeScript cannot find names "Request" and "RequestInit" #810

Closed
opened 2025-08-09 17:17:45 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @robedmo on 4/23/2017

After setting up the ReactReduxSpa template, Visual Studio is listing errors from the following files in the domain-task package (the errors don't always appear; to force them to show up, open one of the files):

  • /fetch.d.ts
  • /src/fetch.ts

For both files, the errors are about being unable to find the names Request and RequestInit. It seems that these are interfaces from isomorphic-fetch, on which domain-task depends.

I was able to fix these errors by taking the following steps:

  • Add a dependency to my project's package.json for @types/isomorphic-fetch. This fixed the errors in /src/fetch.ts.
  • Add the statement import 'isomorphic-fetch'; to the top of /fetch.d.ts. Without this the file is still unable to find the names.

I think the domain-task package should be updated to include @types/isomorphic-fetch as a dependency and to import isomorphic-fetch in /fetch.d.ts. I'm new to TypeScript so if I've missed anything or did something wrong to fix the problem I'd appreciate any feedback.

Edit: I also noticed that aspnet-prerendering installs it's own instance of domain-task (aspnet-prerendering depends on version 2.x.x of domain-task while the project directly depends on version 3.x.x). This instance would also need to be fixed in the same way, either by making aspnet-prerendering depend on domain-task version 3.x.x or by releasing a new 2.x.x version as well.

*Originally created by @robedmo on 4/23/2017* After setting up the ReactReduxSpa template, Visual Studio is listing errors from the following files in the `domain-task` package (the errors don't always appear; to force them to show up, open one of the files): - `/fetch.d.ts` - `/src/fetch.ts` For both files, the errors are about being unable to find the names `Request` and `RequestInit`. It seems that these are interfaces from `isomorphic-fetch`, on which `domain-task` depends. I was able to fix these errors by taking the following steps: - Add a dependency to my project's package.json for `@types/isomorphic-fetch`. This fixed the errors in `/src/fetch.ts`. - Add the statement `import 'isomorphic-fetch';` to the top of `/fetch.d.ts`. Without this the file is still unable to find the names. I think the `domain-task` package should be updated to include `@types/isomorphic-fetch` as a dependency and to import `isomorphic-fetch` in `/fetch.d.ts`. I'm new to TypeScript so if I've missed anything or did something wrong to fix the problem I'd appreciate any feedback. Edit: I also noticed that `aspnet-prerendering` installs it's own instance of `domain-task` (`aspnet-prerendering` depends on version 2.x.x of `domain-task` while the project directly depends on version 3.x.x). This instance would also need to be fixed in the same way, either by making `aspnet-prerendering` depend on `domain-task` version 3.x.x or by releasing a new 2.x.x version as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#810
No description provided.