fix(core): renderer-to-renderer2 migration not migrating methods (#33… · angular/angular@d751ca7 · GitHub
Skip to content

Commit d751ca7

Browse files
devversionatscott
authored andcommitted
fix(core): renderer-to-renderer2 migration not migrating methods (#33571)
The `renderer-to-renderer2` migration currently does not work properly in v9 because the migration relies on the type checker for detecting references to `Renderer` from `@angular/core`. This is contradictory since the `Renderer` is no longer exported in v9 `@angular/core`. In order to make sure that the migration still works in v9, and that we can rely on the type checker for the best possible detection, we take advantage of module augmentation and in-memory add the `Renderer` export to the `@angular/core` module. PR Close #33571
1 parent 974005b commit d751ca7

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

packages/core/schematics/migrations/renderer-to-renderer2/index.ts

Lines changed: 19 additions & 5 deletions

packages/core/schematics/test/renderer_to_renderer2_migration_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ describe('Renderer to Renderer2 migration', () => {
3535
}));
3636
// We need to declare the Angular symbols we're testing for, otherwise type checking won't work.
3737
writeFile('/node_modules/@angular/core/index.d.ts', `
38-
export declare abstract class Renderer {}
3938
export declare function forwardRef(fn: () => any): any {}
4039
`);
4140

packages/core/schematics/utils/typescript/compiler_host.ts

Lines changed: 5 additions & 2 deletions

0 commit comments

Comments
 (0)