Yaffle / EventSource

a polyfill for http://www.w3.org/TR/eventsource/
MIT License
2.11k stars 338 forks source link

Getting Types error while using it in import [Angular] TS #190

Open noobd3v opened 3 years ago

noobd3v commented 3 years ago

Could not find a declaration file for module 'event-source-polyfill'. '../node_modules/event-source-polyfill/src/eventsource.js' implicitly has an 'any' type. Try npm i --save-dev @types/event-source-polyfill if it exists or add a new declaration (.d.ts) file containing declare module 'event-source-polyfill';ts(7016)

import { NativeEventSource, EventSourcePolyfill } from 'event-source-polyfill';

ericwangkai commented 2 years ago

@noobd3v I am using EventSource in my angular project. There is a file named polyfills.ts under root folder. Just add the below into it. Hope this helps.

import 'event-source-polyfill/src/eventsource.min.js';