Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #15 closes #26 Relates to #100 Relates to #108 This approach was originally implemented by @kallaspriit in #100. This approach ships TypeScript types inline with this library rather than relying on global fetch types in lib.dom.d.ts. The benefits of this approach are: 1. It avoids consumers (direct or indirect) needing to add `dom` to their lib setting in tsconfig. This can be very confusing for Node projects and adds legitimate room for error since it allows any DOM globals to be used in the Node app which is almost certainly wrong. 2. The file-directive approach (see #108) fails in two ways: 1. If consumers customize lib config but leave out `dom` things break just the same. 2. It adds dom globals which is bad but now in a very unexpected/hidden way. 3. It aligns well with our ponyfill (not polyfill) approach. The downsides of this approach are: 1. We aren't benefiting from improvements in the TS lib types. So improvements to fetch typing for example would not pass through to graphql-request users transparently. It would require a new release of graphql-request.
- Loading branch information