Skip to content

1.7.8. breaks typescript type generation #6720

@tkalmar

Description

@tkalmar

Describe the bug

We generate some client code with OpenAPI Generator and generate types for it calling tsc
The type definition generated prior 1.7.8. looks like
someAPIMethod(requestParameters: SomeRequestParameters, options?: RequestOptions): Promise<import("axios").AxiosResponse<void, any>>;
when we change to 1.7.8 it becomes:
someAPIMethod(requestParameters: SomeRequestParameters, options?: RequestOptions): Promise<import("axios", { with: { "resolution-mode": "require" } }).AxiosResponse<void, any>>;
Which no longer builds.
I think the culprit is This commit
Typescript recognizes the import from the commonjs types and thinks that the module is commonjs and adds the resolution-mode hint.
I don't think it is correct to import from cjs inside the (ESM)ts types.

To Reproduce

No response

Code snippet

No response

Expected behavior

No response

Axios Version

1.7.8

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions