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:
Miško Hevery
2018-04-13 13:34:39 -07:00
committed by Igor Minar
parent f4017ce5e3
commit 2c09b707ce
32 changed files with 179 additions and 172 deletions

View File

@ -11,7 +11,7 @@ import {Type} from '../type';
import {makeDecorator, makeParamDecorator} from '../util/decorators';
import {getClosureSafeProperty} from '../util/property';
import {InjectableDef, InjectableType, defineInjectable} from './defs';
import {InjectableType, defineInjectable, ɵInjectableDef} from './defs';
import {inject, injectArgs} from './injector';
import {ClassSansProvider, ConstructorProvider, ConstructorSansProvider, ExistingProvider, ExistingSansProvider, FactoryProvider, FactorySansProvider, StaticClassProvider, StaticClassSansProvider, ValueProvider, ValueSansProvider} from './provider';
@ -134,4 +134,4 @@ export const Injectable: InjectableDecorator = makeDecorator(
*
* @experimental
*/
export interface InjectableType<T> extends Type<T> { ngInjectableDef: InjectableDef<T>; }
export interface InjectableType<T> extends Type<T> { ngInjectableDef: ɵInjectableDef<T>; }