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
This commit is contained in:
Paul Gschwendtner
2019-11-05 20:25:46 +01:00
committed by atscott
parent 974005b064
commit d751ca7596
3 changed files with 24 additions and 8 deletions

View File

@ -35,7 +35,6 @@ describe('Renderer to Renderer2 migration', () => {
}));
// We need to declare the Angular symbols we're testing for, otherwise type checking won't work.
writeFile('/node_modules/@angular/core/index.d.ts', `
export declare abstract class Renderer {}
export declare function forwardRef(fn: () => any): any {}
`);