mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): emit pure annotations to static property initializers (#43344)
Currently the pure annotations comments are not emitted because unless the entire expression is wrapped in braces. See the below TypeScript playgrounds https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=8&ssc=1&pln=1&pc=1#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQA9ACpoAAQD6+gAryASgFFD0LRuipMAdziIUGbPgIAKAJQBuKhTUlMB4qBB4IJgAdCB4AOaegu6EUbBKin5UQA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { } exports.Injector = Injector; Injector.NULL = new NullInjector(); console.log(Injector.NULL); ``` https://www.typescriptlang.org/play?target=99&module=1&ts=4.4.2&ssl=4&ssc=18&pln=4&pc=33#code/MYGwhgzhAEByCuIQEkB2ArApsALgewCdoBvAXwFgAoKzADwAdCdowAjCHAsXaUSGNFlyESVaNA5gcAS2BwAqgBlF0ALzQAFAHoAVNAACAfUMAFeQCUAoseg6t0VJgDucRCgzZ8BDQEofAbioKakpgPFQIPBBMADoQPABzDUFPQhjYJUUAqiA ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Injector = void 0; class NullInjector { } class Injector { }a exports.Injector = Injector; Injector.NULL = ( /* @__PURE__ */new NullInjector()); console.log(Injector.NULL); ``` PR Close #43344
This commit is contained in:
committed by
Andrew Kushnir
parent
4c307ad8d7
commit
c80278ac4a
@@ -59,7 +59,7 @@ export const INJECTOR_IMPL = INJECTOR_IMPL__PRE_R3__;
|
||||
*/
|
||||
export abstract class Injector {
|
||||
static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
|
||||
static NULL: Injector = /* @__PURE__ */ new NullInjector();
|
||||
static NULL: Injector = (/* @__PURE__ */ new NullInjector());
|
||||
|
||||
/**
|
||||
* Retrieves an instance from the injector based on the provided token.
|
||||
|
||||
@@ -270,7 +270,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
}
|
||||
|
||||
export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
private static INJECTOR_KEY = /* @__PURE__ */ ReflectiveKey.get(Injector);
|
||||
private static INJECTOR_KEY = (/* @__PURE__ */ ReflectiveKey.get(Injector));
|
||||
/** @internal */
|
||||
_constructionCounter: number = 0;
|
||||
/** @internal */
|
||||
|
||||
@@ -46,7 +46,7 @@ of the code in this cookbook
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class ComponentFactoryResolver {
|
||||
static NULL: ComponentFactoryResolver = /* @__PURE__ */ new _NullComponentFactoryResolver();
|
||||
static NULL: ComponentFactoryResolver = (/* @__PURE__ */ new _NullComponentFactoryResolver());
|
||||
/**
|
||||
* Retrieves the factory object that creates a component of the given type.
|
||||
* @param component The component type.
|
||||
|
||||
Reference in New Issue
Block a user