I'm using node 18.16.1 and typescript 5.2.2.
My tsconfig.json:
{
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"outDir": "dist"
},
"include": ["src/**/*"]
}
A file src/test.mts:
import { request } from "urllib";
const test = await request("test");
The variable test has type any.
If I switch off skipLibCheck in typescript, I see a number of errors in urllib:
node_modules/urllib/src/esm/index.d.ts:1:44 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './Request.js'?
1 import { RequestOptions, RequestURL } from './Request';
~~~~~~~~~~~
node_modules/urllib/src/esm/index.d.ts:2:101 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16'
or 'nodenext'. Did you mean './Response.js'?
2 export declare function request<T = any>(url: RequestURL, options?: RequestOptions): Promise<import("./Response").HttpClientResponse<T>>;
~~~~~~~~~~~~
node_modules/urllib/src/esm/index.d.ts:3:98 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './Response.js'?
3 export declare function curl<T = any>(url: RequestURL, options?: RequestOptions): Promise<import("./Response").HttpClientResponse<T>>;
~~~~~~~~~~~~
node_modules/urllib/src/esm/index.d.ts:5:144 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16'
or 'nodenext'. Did you mean './HttpClient.js'?
5 export { HttpClient, HttpClient as HttpClient2, HEADER_USER_AGENT as USER_AGENT, RequestDiagnosticsMessage, ResponseDiagnosticsMessage, } from './HttpClient';
~~~~~~~~~~~~~~
node_modules/urllib/src/esm/index.d.ts:6:133 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16'
or 'nodenext'. Did you mean './Request.js'?
6 export { RequestOptions, RequestOptions as RequestOptions2, RequestURL, HttpMethod, FixJSONCtlCharsHandler, FixJSONCtlChars, } from './Request';
~~~~~~~~~~~
node_modules/urllib/src/esm/index.d.ts:7:77 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './Response.js'?
7 export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response';
~~~~~~~~~~~~
I'm not sure if they're related.
Am I doing something wrong? Something wrong with my TS configuration? Am I using an unsupported target?
I'm using node 18.16.1 and typescript 5.2.2.
My tsconfig.json:
{ "extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"], "compilerOptions": { "allowSyntheticDefaultImports": true, "outDir": "dist" }, "include": ["src/**/*"] }A file
src/test.mts:The variable
testhas typeany.If I switch off
skipLibCheckin typescript, I see a number of errors in urllib:I'm not sure if they're related.
Am I doing something wrong? Something wrong with my TS configuration? Am I using an unsupported target?