Skip to content

Library build generates invalid declaration "import '@angular/material/dialog.d'" in generated index.d.ts #33665

Description

@PanJoh

Which @angular/* package(s) are the source of the bug?

compiler-cli

Is this a regression?

No

Description

Command

ng build uxf-core

Description

When building an Angular library, the generated index.d.ts contains the following import:

import * as _angular_material_dialog_d from '@angular/material/dialog.d';

It goes away, when we do the following changes in our source code.

From:
´´´ts
open<T, D = any, R = any>(component: ComponentType, config?: MatDialogConfig) {
return this.dialog.open<T, D, R>(component, {
...config,
panelClass: createPanelClass(config?.panelClass)
});
}
´´´´

To:
´´´ts
open<T, D = any, R = any>(component: ComponentType, config?: MatDialogConfig): MatDialogRef<R,T> {
return this.dialog.open<T, D, R>(component, {
...config,
panelClass: createPanelClass(config?.panelClass)
});
}
´´´´
Unfortunately we do not yet have a minimal reproduction, but the issue is consistently reproducible in our library build.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

When the library is consumed as a package by another Angular application, the application build fails with:
 
> Error: node_modules/@uxf/core/index.d.ts:57:45 - error TS2037:
> Cannot find module '@angular/material/dialog.d'
> or its corresponding type declarations
> 
> 57 import * as _angular_material_dialog_d from '@angular/material/dialog.d';

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.3.22
Node: 24.18.0
Package Manager: npm 11.18.0
OS: win32 x64

Angular: 20.3.25
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, upgrad

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/buildgemini-triagedLabel noting that an issue has been triaged by geminineeds: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions