admin 管理员组文章数量: 1086019
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 badges2 Answers
Reset to default 6Add 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 {}
本文标签: javascriptaureliafetchclientdts undefined symbolsStack Overflow
版权声明:本文标题:javascript - aurelia-fetch-client.d.ts undefined symbols - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744093868a2532535.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论