From b325ad17352f9418b6beb2d810b8b0c9c9f7bd23 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 22 Jul 2018 18:27:36 +0200 Subject: Add additional required tsconfig option for utils package since it now relies on RequestInit & Response types defined in lib.dom.d.ts --- packages/utils/README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'packages/utils/README.md') diff --git a/packages/utils/README.md b/packages/utils/README.md index c637c9af5..82421e3ff 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -12,6 +12,7 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol ```json "compilerOptions": { + "lib": ["dom"], "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], } ``` -- cgit v1.2.3 From 4f73b81b9cb421817b56f747c367a02a37f16ce5 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 23 Jul 2018 11:00:27 +0200 Subject: Add troubleshooting section to utils README --- packages/utils/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'packages/utils/README.md') diff --git a/packages/utils/README.md b/packages/utils/README.md index 82421e3ff..c9a2f5846 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -12,7 +12,6 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol ```json "compilerOptions": { - "lib": ["dom"], "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], } ``` @@ -23,6 +22,21 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol import { addressUtils, bigNumberConfigs, classUtils, intervalUtils, promisify } from '@0xproject/utils'; ``` +## Troubleshooting + +If you are still seeing TS type errors complaining about missing DOM types such as `Response`: + +``` +error TS2304: Cannot find name 'Response'. +``` + +Then you need to explicitly add the `dom` lib to your compiler options in `tsconfig.json`. The `dom` library is included by default, but customizing the `lib` option can cause it to be dropped. + +``` +"compilerOptions": { + "lib": [..., "dom"], +``` + ## Contributing We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. -- cgit v1.2.3