-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed as not planned
Closed as not planned
Copy link
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilergemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminineeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate further
Milestone
Description
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
When using input.required<T | null>() or input<T | null>() in a library built with ng-packagr (partial compilation mode), the Angular compiler strips | null from the generated .d.ts files.
Source:
a = input.required<T | null>();
b = input<T | null>();Expected .d.ts (matches plain tsc --emitDeclarationOnly):
a: InputSignal<T | null>;
b: InputSignal<T | null | undefined>;Actual .d.ts from Angular compiler (partial mode):
a: _angular_core.InputSignal<T>;
b: _angular_core.InputSignal<T>;Investigation:
I intercepted the in-memory .d.ts content from ng-packagr's file cache (before rollup-plugin-dts bundling) and confirmed | null was already missing at that stage. Plain tsc --emitDeclarationOnly on the same source produces correct types.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular 21.2.x, ng-packagr 21.2.0, TypeScript 5.9.3
Anything else?
A workaround is to force the type and not rely on type inference.
Example:
a: InputSignal<T | null> = input<T| null>();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilergemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminineeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate further