lquixada / cross-fetch

Universal WHATWG Fetch API for Node, Browsers and React Native.
MIT License
1.67k stars 104 forks source link

Compilation error with version 3.1.0 #94

Closed apupier closed 3 years ago

apupier commented 3 years ago

upgrading from 3.0.6 to 3.1.0, I'm hitting these compilation errors:

node_modules/cross-fetch/index.d.ts:18:14 - error TS2304: Cannot find name 'BodyInit'.

18   new(body?: BodyInit | null, init?: ResponseInit): Response;
                ~~~~~~~~

node_modules/cross-fetch/index.d.ts:18:38 - error TS2304: Cannot find name 'ResponseInit'.

18   new(body?: BodyInit | null, init?: ResponseInit): Response;
                                        ~~~~~~~~~~~~

node_modules/cross-fetch/index.d.ts:25:14 - error TS2304: Cannot find name 'HeadersInit'.

25   new(init?: HeadersInit): Headers;

environment versions:

(base) [apupier@fedora vscode-camelk]$ nvm version
v11.15.0
(base) [apupier@fedora vscode-camelk]$ npm --version
6.7.0
lquixada commented 3 years ago

@apupier thanks for reporting the issue! can you provide more info on how to reproduce that error? the typescript version and tsconfig would also be helpful.

apupier commented 3 years ago
apupier commented 3 years ago

tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        "outDir": "out",
        "lib": [
            "es6"
        ],
        "sourceMap": true,
        "resolveJsonModule": true,
        /* Strict Type-Checking Option */
        "strict": true,   /* enable all strict type-checking options */
        /* Additional Checks */
        "noUnusedLocals": true /* Report errors on unused locals. */
        // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
        // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
        // "noUnusedParameters": true,  /* Report errors on unused parameters. */
    },
    "include": [
        "src"
    ],
    "exclude": [
        "node_modules",
        ".vscode-test",
        "test-resources"
    ]
}
apupier commented 3 years ago

typescript version ^4.2.3

pitgrap commented 3 years ago

Same here. If I open the index.d.ts all 3 lines are marked "red" in my IDE. BodyInit and HeadersInit are missing in the import, but ResponseInit is not existing at all. :(

Caused by PR #93

lquixada commented 3 years ago

ok, this is supposed to be fixed on 3.1.1. please let me know if other issues come up. closing this for now.