Definitelytyped: Namespace '"http"' has no exported member 'ClientResponse'.

Created on 12 Oct 2018  路  1Comment  路  Source: DefinitelyTyped/DefinitelyTyped

Hi everyone,
using the types for node 10.11 ("@ types / node": "^ 10.11.4") I get the following error:

 error TS2694: Namespace '"http"' has no exported member 'ClientResponse'.

An example of code that generates it is as follows:

import http from "http"
readInitializerConfiguration (name: string, pretty ?: string, exact ?: boolean, _export ?: boolean): Promise <{
        response: http.ClientResponse;
        body: V1alpha1InitializerConfiguration;
    }>;

Everything works correctly with node 8 (types "@types/node": "^8.10.36"

tsc version: 3.1.1

tsconfig.json

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "lib": [
          "es2015",
        ], 
       "declaration": false,
        "declarationMap": false,
        "sourceMap": true,
        "outDir": "./build/",
        "strict": true,
        "noImplicitAny": true,
        "strictNullChecks": true,
        "strictFunctionTypes": true,
        "strictPropertyInitialization": true,
        "noImplicitThis": true,
        "alwaysStrict": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": true, 
        "baseUrl": "./", 
        "esModuleInterop": true

    },
    "exclude": [
        "**/__TEST__/**"
    ]
}

Most helpful comment

Node doesn't export a type ClientResponse (at least not in recent versions). The correct type is IncomingMessage. Node 8 typings work because they have an alias - which is marked as @deprecated. In Node 10 typings this alias was removed recently.

>All comments

Node doesn't export a type ClientResponse (at least not in recent versions). The correct type is IncomingMessage. Node 8 typings work because they have an alias - which is marked as @deprecated. In Node 10 typings this alias was removed recently.

Was this page helpful?
0 / 5 - 0 ratings