Skip to content

The adapter azure-storage-adapter throws type check error #149

Description

@alexandrubau

Following the official example from here you will encounter the following error:

Argument of type 'import("/<project_path>/node_modules/@azure/storage-blob/dist/commonjs/ContainerClient").ContainerClient' is not assignable to parameter of type 'import("/<project_path>/node_modules/@azure/storage-blob/dist/esm/ContainerClient", { with: { "resolution-mode": "import" } }).ContainerClient'.
  Types have separate declarations of a private property 'containerContext'.ts(2345)

To address this issue you need to type-cast using "any". Example:

import {BlobServiceClient} from '@azure/storage-blob';
import {FileStorage} from '@flystorage/file-storage';
import {AzureStorageBlobStorageAdapter} from '@flystorage/azure-storage-blob';

const blobService = BlobServiceClient.fromConnectionString(process.env.AZURE_DSN!);
const container = blobService.getContainerClient('flysystem');
const adapter = new AzureStorageBlobStorageAdapter(container as any); // <-- I've added "as any"
const storage = new FileStorage(adapter);

Here is my package.json version:

"@azure/storage-blob": "^12.28.0",
"@flystorage/azure-storage-blob": "^1.2.0",
"@flystorage/file-storage": "^1.2.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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