Skip to content

bug(MATERIAL): Hashed Imports are generated in a .d.ts for a Library based on Angular Material >= 19.2.4 #30913

Closed
@DerAlbertCom

Description

@DerAlbertCom

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

19.2.3

Description

We have an internal Component Library which is based on Angular Material.

Since Angular Material Version 19.2.4 and up to19.2.10 some of our Services are a created wrong, the included import with a concrete hash in the .d.ts which obviously tends to compile time problems if the user does not also have the exact Angular Material Version in his project.

I created a “minimal” repo, based on our library project structure.

I also saw other Issues with a similar problem (also with 19.2.4), but it appears that this is different because it still happens with the current version of Angular Material.

Reproduction

https://stackblitz.com/~/github.com/DerAlbertCom/AngularMaterialBug

Reproduce

  1. cd ng-mono
  2. npm install
  3. npm run lib:build
  4. look at the generated file
  5. https://stackblitz.com/~/github.com/DerAlbertCom/AngularMaterialBug?file=ng-mono/dist/%40dummy/unity-lib/confirm/dummy-confirmation.service.d.ts

Expected Behavior

Creating a d.ts file with the general import, without the hash, like in all Version before 19.2.4.

export declare class DummyConfirmationService {
    private readonly matDialog;
    confirm$<T = boolean>(data?: DummyDialogConfirmComponentData<T>, options?: MatDialogConfig<DummyDialogConfirmComponentData<T>>): import("@angular/material/dialog").MatDialogRef<DummyDialogConfirmComponent<T>, T | null>;
    dialog$<T, D = any, R = any>(component: ComponentType<T>, data?: D, options?: MatDialogConfig<D>): import("@angular/material/dialog").MatDialogRef<T, R>;
    static ɵfac: i0.ɵɵFactoryDeclaration<DummyConfirmationService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<DummyConfirmationService>;
}

Actual Behavior

The d.ts file is generated with the Hash in the import, this happens since Version 19.2.4

export declare class DummyConfirmationService {
    private readonly matDialog;
    confirm$<T = boolean>(data?: DummyDialogConfirmComponentData<T>, options?: MatDialogConfig<DummyDialogConfirmComponentData<T>>): import("@angular/material/dialog.d-Dvsbu-0E").MatDialogRef<DummyDialogConfirmComponent<T>, T | null>;
    dialog$<T, D = any, R = any>(component: ComponentType<T>, data?: D, options?: MatDialogConfig<D>): import("@angular/material/dialog.d-Dvsbu-0E").MatDialogRef<T, R>;
    static ɵfac: i0.ɵɵFactoryDeclaration<DummyConfirmationService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<DummyConfirmationService>;
}

Environment

  • Angular: 19.x,
  • CDK/Material:19.2.4 to 19.2.10
  • Operating System: Windows 11 24H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: dev-infraIssue related to internal project infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions