Skip to content

Cannot create AzureServerStorage with moduleResolution set to NodeNext #134

@GytisCepk

Description

@GytisCepk

I'm trying to create AzureServerStorage without using inversify and running into following error:

index.ts:19:105 - error TS2345: Argument of type 'import("/home/gytis/snippets/create-object-storage-impl-without-inversify-esm-problem/node_modules/.pnpm/@azure+storage-blob@12.28.0/node_modules/@azure/storage-blob/dist/esm/BlobServiceClient", { with: { "resolution-mode": "import" } }).BlobServiceClient' is not assignable to parameter of type 'import("/home/gytis/snippets/create-object-storage-impl-without-inversify-esm-problem/node_modules/.pnpm/@azure+storage-blob@12.28.0/node_modules/@azure/storage-blob/dist/commonjs/BlobServiceClient").BlobServiceClient'.
  Types have separate declarations of a private property 'serviceContext'.

19 const objectStorage: ServerStorage = new AzureServerStorage(storageConfig, new BlobServiceClientWrapper(blobServiceClient));

We have moduleResolution set to NodeNext as we're working on modern Node.js application.

This could be fixed if object-storage would provide ESM exports.

Gist to reproduce issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions