refactor(core): remove unnecessary cast (#41960)

The `as any` is no longer needed since `providedIn` can accept `'any'`.

PR Close #41960
This commit is contained in:
Pete Bacon Darwin 2021-05-06 20:24:43 +01:00 committed by Alex Rickabaugh
parent adc732decb
commit d59f2b0d0c
2 changed files with 6 additions and 7 deletions

View File

@ -272,25 +272,24 @@ describe('processNgModuleDocs processor', () => {
}); });
/** /**
* This function simulates a TS AST node for the code: * This function simulates a TypeScript AST node for the code:
* *
* ``` * ```
* static ɵprov = ɵɵdefineInjectable({ * static ɵprov = ɵɵdefineInjectable({
* providedIn: 'xxxx', * providedIn: 'xxxx',
* }); * });
* ``` * ```
*
*/ */
function createSymbolWithProvider(providedIn) { function createSymbolWithProvider(providedIn) {
const initializer = { const initializer = {
pos: 0, pos: 0,
end: providedIn.length, end: providedIn.length,
getSourceFile() { getSourceFile() {
return { text: providedIn }; return { text: providedIn };
} }
}; };
const valueDeclaration = { initializer: { arguments: [{ properties: [ { name: { text: 'providedIn' }, initializer } ] } ] } }; const valueDeclaration = { initializer: { arguments: [{ properties: [{ name: { text: 'providedIn' }, initializer }] }] } };
const exportMap = new Map(); const exportMap = new Map();
exportMap.set('ɵprov', {valueDeclaration}); exportMap.set('ɵprov', { valueDeclaration });
return {exports: exportMap}; return { exports: exportMap };
} }

View File

@ -106,7 +106,7 @@ export abstract class Injector {
/** @nocollapse */ /** @nocollapse */
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable({ static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable({
token: Injector, token: Injector,
providedIn: 'any' as any, providedIn: 'any',
factory: () => ɵɵinject(INJECTOR), factory: () => ɵɵinject(INJECTOR),
}); });