最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - aurelia-fetch-client.d.ts undefined symbols - Stack Overflow

programmeradmin9浏览0评论

When I include aurelia-fetch-client in my project, I get some errors that I can't resolve. It says that it can't find: Request, Response, Headers, BufferSource, URLSearchParams, as you can see in the following image:

How can I solve that?

When I include aurelia-fetch-client in my project, I get some errors that I can't resolve. It says that it can't find: Request, Response, Headers, BufferSource, URLSearchParams, as you can see in the following image:

How can I solve that?

Share Improve this question edited Oct 12, 2016 at 22:58 Jeremy Danyow 26.4k12 gold badges90 silver badges135 bronze badges asked Aug 24, 2015 at 9:46 Cosmin IonițăCosmin Ioniță 4,0655 gold badges29 silver badges54 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Add the typescript definition file for whatwg-fetch:

https://github./borisyankov/DefinitelyTyped/blob/master/whatwg-fetch/whatwg-fetch.d.ts

Here's more info on the fetch spec:

https://developer.mozilla/en-US/docs/Web/API/Fetch_API

Install whatwg-fetch types with typings.

It's possible use typings to install the whatwg-fetch types.

npm install typings --global
typings install dt~whatwg-fetch --global

The above installs them from DefinitelyTyped (dt).

Install whatwg-fetch types with npm (TypeScript 2.0).

npm install --save @types/whatwg-fetch

Further Tweaks

Note: TypeScript might still plain that it "Cannot find name 'URLSearchParams'." We can fix that by adding the an interface to one of our typings files. For instance:

custom_typings/adhoc_interfaces.d.ts

interface URLSearchParams {}
发布评论

评论列表(0)

  1. 暂无评论