refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
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 `OpaqueToken`. By prefixing the type with `ɵ` we are communicating the the outside world that the value is not public API and is subject to change without backward compatibility. PR Close #23371
This commit is contained in:

committed by
Igor Minar

parent
f4017ce5e3
commit
2c09b707ce
@ -2151,7 +2151,7 @@ describe('ngc transformer command-line', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('compiles a basic InjectableDef', () => {
|
||||
it('compiles a basic ɵInjectableDef', () => {
|
||||
const source = compileService(`
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Module} from './module';
|
||||
@ -2187,7 +2187,7 @@ describe('ngc transformer command-line', () => {
|
||||
expect(source).toMatch(/\/\*\* @nocollapse \*\/ Service\.ngInjectableDef =/);
|
||||
});
|
||||
|
||||
it('compiles a useValue InjectableDef', () => {
|
||||
it('compiles a useValue ɵInjectableDef', () => {
|
||||
const source = compileService(`
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Module} from './module';
|
||||
@ -2203,7 +2203,7 @@ describe('ngc transformer command-line', () => {
|
||||
expect(source).toMatch(/ngInjectableDef.*return CONST_SERVICE/);
|
||||
});
|
||||
|
||||
it('compiles a useExisting InjectableDef', () => {
|
||||
it('compiles a useExisting ɵInjectableDef', () => {
|
||||
const source = compileService(`
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Module} from './module';
|
||||
@ -2220,7 +2220,7 @@ describe('ngc transformer command-line', () => {
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\.inject\(Existing\)/);
|
||||
});
|
||||
|
||||
it('compiles a useFactory InjectableDef with optional dep', () => {
|
||||
it('compiles a useFactory ɵInjectableDef with optional dep', () => {
|
||||
const source = compileService(`
|
||||
import {Injectable, Optional} from '@angular/core';
|
||||
import {Module} from './module';
|
||||
@ -2240,7 +2240,7 @@ describe('ngc transformer command-line', () => {
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\(..\.inject\(Existing, 8\)/);
|
||||
});
|
||||
|
||||
it('compiles a useFactory InjectableDef with skip-self dep', () => {
|
||||
it('compiles a useFactory ɵInjectableDef with skip-self dep', () => {
|
||||
const source = compileService(`
|
||||
import {Injectable, SkipSelf} from '@angular/core';
|
||||
import {Module} from './module';
|
||||
|
Reference in New Issue
Block a user