fix(ivy): @Inject should not overwrite an existing ngInjectableDef (#27278)

There is no test in this diff because I've made a failing test pass.

PR Close #27278
This commit is contained in:
Igor Minar 2018-11-17 22:36:23 -08:00 committed by Jason Aden
parent d35d164ece
commit 1cca27d823
1 changed files with 4 additions and 0 deletions

View File

@ -27,6 +27,10 @@ export function compileInjectable(type: Type<any>, srcMeta?: Injectable): void {
const meta: Injectable = srcMeta || {providedIn: null}; const meta: Injectable = srcMeta || {providedIn: null};
let def: any = null; let def: any = null;
// if NG_INJECTABLE_DEF is already defined on this class then don't overwrite it
if (type.hasOwnProperty(NG_INJECTABLE_DEF)) return;
Object.defineProperty(type, NG_INJECTABLE_DEF, { Object.defineProperty(type, NG_INJECTABLE_DEF, {
get: () => { get: () => {
if (def === null) { if (def === null) {