refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371) (#23383)
Ivy definition looks something like this: ``` class MyService { static ngInjectableDef = defineInjectable({ … }); } ``` Here the argument to `defineInjectable` is well known public contract which needs to be honored in backward compatible way between versions. The type of the return value of `defineInjectable` on the other hand is private and can change shape drastically between versions without effecting backwards compatibility of libraries publish to NPM. To our users it is effectively an opaque token. For this reson why declare the return value of `defineInjectable` as `never`. PR Close #23383
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {InjectableDef, defineInjectable} from '../../di/defs';
|
||||
import {defineInjectable} from '../../di/defs';
|
||||
import {Optional, SkipSelf} from '../../di/metadata';
|
||||
import {StaticProvider} from '../../di/provider';
|
||||
import {DefaultIterableDifferFactory} from '../differs/default_iterable_differ';
|
||||
@ -137,7 +137,7 @@ export interface IterableDifferFactory {
|
||||
*
|
||||
*/
|
||||
export class IterableDiffers {
|
||||
static ngInjectableDef: InjectableDef<IterableDiffers> = defineInjectable({
|
||||
static ngInjectableDef = defineInjectable({
|
||||
providedIn: 'root',
|
||||
factory: () => new IterableDiffers([new DefaultIterableDifferFactory()])
|
||||
});
|
||||
|
Reference in New Issue
Block a user