You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(compiler-cli): show specific error for unresolved @HostListener's event name in local compilation mode (#54230)
Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.
PR Close#54230
Copy file name to clipboardExpand all lines: packages/compiler-cli/test/ngtsc/local_compilation_spec.ts
+64Lines changed: 64 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1319,6 +1319,70 @@ runInEachFileSystem(
1319
1319
expect(text).toEqual(
1320
1320
'Unresolved identifier found for @Component.selector field! Did you import this identifier from a file outside of the compilation unit? This is not allowed when Angular compiler runs in local mode. Possible solutions: 1) Move the declarations into a file within the compilation unit, 2) Inline the selector');
1321
1321
});
1322
+
1323
+
it('should show correct error message when using an external symbol for component @HostListener\'s event name argument',
1324
+
()=>{
1325
+
env.write('test.ts',`
1326
+
import {Component, HostListener} from '@angular/core';
`Unresolved identifier found for @HostListener's event name argument! Did you import this identifier from a file outside of the compilation unit? This is not allowed when Angular compiler runs in local mode. Possible solutions: 1) Move the declaration into a file within the compilation unit, 2) Inline the argument`
1353
+
);
1354
+
});
1355
+
1356
+
it('should show correct error message when using an external symbol for directive @HostListener\'s event name argument',
1357
+
()=>{
1358
+
env.write('test.ts',`
1359
+
import {Directive, HostListener} from '@angular/core';
`Unresolved identifier found for @HostListener's event name argument! Did you import this identifier from a file outside of the compilation unit? This is not allowed when Angular compiler runs in local mode. Possible solutions: 1) Move the declaration into a file within the compilation unit, 2) Inline the argument`
0 commit comments