refactor(ivy): remove type from DirectiveDef (#21374)

This change makes the code cleaner for the user. It does mean
a little bit more work for us since we have to patch the `type` back
into the `DirectiveDef`. However since the patching happens only once
on startup it should not be significant.

PR Close #21374
This commit is contained in:
Miško Hevery
2018-01-09 16:43:12 -08:00
committed by Alex Eagle
parent 16232f000f
commit 5eaaac35a8
23 changed files with 108 additions and 212 deletions

View File

@ -38,7 +38,6 @@ describe('lifecycles', () => {
ngOnInit() { events.push(`${name}${this.val}`); }
static ngComponentDef = defineComponent({
type: Component,
tag: name,
factory: () => new Component(),
hostBindings: function(directiveIndex: number, elementIndex: number):
@ -271,7 +270,6 @@ describe('lifecycles', () => {
ngOnInit() { allEvents.push('ngOnInit ' + name); }
static ngComponentDef = defineComponent({
type: Component,
tag: name,
factory: () => new Component(),
hostBindings: function(
@ -363,7 +361,6 @@ describe('lifecycles', () => {
ngAfterViewChecked() { allEvents.push(`${name}${this.val} check`); }
static ngComponentDef = defineComponent({
type: Component,
tag: name,
factory: () => new Component(),
refresh: (directiveIndex: number, elementIndex: number) => {
@ -405,7 +402,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -492,7 +488,6 @@ describe('lifecycles', () => {
E(0, Comp);
e();
C(2);
c();
E(3, Comp);
e();
}
@ -536,7 +531,6 @@ describe('lifecycles', () => {
E(0, Parent);
e();
C(2);
c();
E(3, Parent);
e();
}
@ -621,7 +615,6 @@ describe('lifecycles', () => {
E(0, Parent);
e();
C(2);
c();
E(3, Parent);
e();
}
@ -674,7 +667,6 @@ describe('lifecycles', () => {
ngOnDestroy() { events.push(`${name}${this.val}`); }
static ngComponentDef = defineComponent({
type: Component,
tag: name,
factory: () => {
const comp = new Component();