Library compilation fails with compiler-cli v12.2.7
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
compiler-cli
Is this a regression?
Yes
Description
Some changes in v12.2.7 of compiler-cli
(type-checker fix from PR #43511, I believe), make my library compilation fail with the “Unable to write a reference to <SomeTypeName>
” error.
The error occurs during compilation time and only if there is at least one usage of some component with type parameters, from another library, exists. Those type parameters are custom ones — not the built-in TS types, which seem to work fine.
Rolling back compiler-cli
package to v12.2.6 makes compilation to work again.
Example:
- my-lib1
export type MyValue<T, K extends keyof T = keyof T> = T | T[K];
export type MyValueArray<T> = T | T[];
@Component({
selector: 'my-comp',
template: `
{{ value }}
`,
})
export class MyComponent<T = any, V extends MyValue<T> = any> {
@Input() data: T[];
@Input() value: V;
}
- my-lib2
@Component({
selector: 'some-comp',
template: `
<my-comp [data]="[]" [value]="null"></my-comp>
`,
})
export class SomeComponent {
// empty
}
Then compilation of my-lib2
fails with the message:
Unable to write a reference to MyValue in my-lib1/.../my-component.d.ts from my-lib/.../some-component.ngtypecheck.ts
.
Please provide a link to a minimal reproduction of the bug
https://github.com/amariq/angular-pr43511-bug
Please provide the exception or error you saw
✖ Compiling with Angular sources in Ivy partial compilation mode.
Unable to write a reference to <SomeInterface> in <some-lib>/.../<some-component>.d.ts from <my-lib>/.../<my-component>.ngtypecheck.ts
Please provide the environment you discovered this bug in
Angular CLI: 12.2.7
Node: 16.10.0
Package Manager: 7.24.1
OS: Windows 10 x64
Angular: 12.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy: "partial"
Package Version
---------------------------------------------------------
@angular-devkit/build-angular 12.2.7
@angular/animations 12.2.7
@angular/cli 12.2.7
@angular/common 12.2.7
@angular/compiler-cli 12.2.7
@angular/compiler 12.2.7
@angular/core 12.2.7
@angular/forms 12.2.7
@angular/platform-browser-dynamic 12.2.7
@angular/platform-browser 12.2.7
@angular/router 12.2.7
ng-packagr 12.2.2
rxjs 6.6.7
tslib 2.3.1
typescript 4.3.5
zone.js 0.11.4
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top Results From Across the Web
angular 13 ng build library fails (ivy partial compilation mode)
I try ng build my-lib and get the below error. ✖ Compiling with Angular sources in Ivy partial compilation mode. Transform failed with ......
Read more >Luminous - Ceph Documentation
build/ops: Boost system library is no longer required to compile and link example librados program (issue#25054, pr#23202, Nathan Cutler).
Read more >CUDA Compiler Driver NVCC - NVIDIA Documentation Center
It allows running the compiled and linked executable without having to explicitly set the library path to the CUDA dynamic libraries. Unless a...
Read more >User's Guide for Quantum ESPRESSO (v.6.1)
This guide gives a general overview of the contents and of the installation of Quantum. ESPRESSO (opEn-Source Package for Research in Electronic Structure, ......
Read more >Spring Boot Reference Documentation
You can use Spring Boot in the same way as any standard Java library. ... name="spring-boot-starter" rev="${spring-boot.version}" conf="compile" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sorry I haven’t had time to look at your repro yet.
You should be able to workaround by using an import in the extends clause:
If at least one of such import expressions is used, the compiler will not attempt to create any references at all.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.