angular/packages/compiler-cli/src
Kristiyan Kostadinov f187c3abf8 fix(compiler-cli): defer symbols only used in types (#58104)
Currently we don't defer any symbols that have references outside of the `import` statement and the `imports` array. This is a bit too aggressive, because it's possible that the symbol is only used for types (e.g. `viewChild<SomeCmp>('ref')`) which will be stripped when emitting to JS.

These changes expand the logic so that references inside type nodes aren't considered.

**Note:** one special case is when the symbol used in constructor-based DI (e.g. `constructor(someCmp: SomeCmp)`, because these constructors will be compiled to `directiveInject` calls. We don't need to worry about them, because the compiler introduces an addition `import * as i1 from './some-cmp';` import that it uses to refer to the symbol.

Fixes #55991.

PR Close #58104
2024-10-07 08:26:07 -07:00
..
bin refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
ngtsc fix(compiler-cli): defer symbols only used in types (#58104) 2024-10-07 08:26:07 -07:00
transformers refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
extract_i18n.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
main.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
perform_compile.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
perform_watch.ts refactor(compiler): update dependency chokidar to v4 (#57945) 2024-10-04 10:56:03 -07:00
typescript_support.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
version.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
version_helpers.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00