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__/**"
]
}
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.
Most helpful comment
Node doesn't export a type
ClientResponse(at least not in recent versions). The correct type isIncomingMessage. Node 8 typings work because they have an alias - which is marked as@deprecated. In Node 10 typings this alias was removed recently.