jefflau / jest-fetch-mock

Jest mock for fetch
MIT License
883 stars 116 forks source link

docs: update TypeScript setup with ES imports #136

Closed sarahdayan closed 3 years ago

sarahdayan commented 4 years ago

This updates the TypeScript install section of the README with ES imports instead of CommonJS require. This is especially useful for stricter ESLint configurations that enforce ES imports.

yinzara commented 4 years ago

This actually will not work. There is no default export to the .index.d.ts file so the syntax you're suggesting won't function.

With ES6 it is much simpler to initialize this library:

import 'jest-fetch-mock'

fetchMock.enableMocks()