perf: latest tsickle to tree shake: abstract class methods & interfaces (#18236)

In previous version of tsickle abstract class methods were materialized.
The change resulted in 6Kb savings in angular.io bundle.

This change also required the removal of `@private` and `@return` type
annotation as it is explicitly dissalowed by tsickle.

NOTE: removed casts in front of `makeDecorator` due to:
https://github.com/angular/devkit/issues/45

```
 14938 Jul 19 13:16 0.b19e913fbdd6507d346b.chunk.js
  1535 Jul 19 13:16 inline.d8e019ea3cfdd86c2bd0.bundle.js
589178 Jul 19 13:16 main.54c97bcb6f254776b678.bundle.js
 34333 Jul 19 13:16 polyfills.4a3c9ca9481d53803157.bundle.js

 14938 Jul 18 16:55 0.b19e913fbdd6507d346b.chunk.js
  1535 Jul 18 16:55 inline.0c83abb44fad9a2768a7.bundle.js
582786 Jul 18 16:55 main.ea290db71b051813e156.bundle.js
 34333 Jul 18 16:55 polyfills.4a3c9ca9481d53803157.bundle.js

main savings: 589178 - 582786 = 6,392
```

PR Close #18236
This commit is contained in:
Miško Hevery
2017-07-19 14:01:28 -07:00
committed by Miško Hevery
parent 7ae7573bc8
commit b7a6f52d59
21 changed files with 40 additions and 55 deletions

View File

@ -201,12 +201,11 @@ export type ContentChildren = Query;
* @stable
* @Annotation
*/
export const ContentChildren: ContentChildrenDecorator =
<ContentChildrenDecorator>makePropDecorator(
'ContentChildren',
(selector?: any, data: any = {}) =>
({selector, first: false, isViewQuery: false, descendants: false, ...data}),
Query);
export const ContentChildren: ContentChildrenDecorator = makePropDecorator(
'ContentChildren',
(selector?: any, data: any = {}) =>
({selector, first: false, isViewQuery: false, descendants: false, ...data}),
Query);
/**
* Type of the ContentChild decorator / constructor function.

View File

@ -400,7 +400,7 @@ export interface Directive {
* @Annotation
*/
export const Directive: DirectiveDecorator =
<DirectiveDecorator>makeDecorator('Directive', (dir: Directive = {}) => dir);
makeDecorator('Directive', (dir: Directive = {}) => dir);
/**
* Type of the Component decorator / constructor function.
@ -683,7 +683,7 @@ export interface Component extends Directive {
* @stable
* @Annotation
*/
export const Component: ComponentDecorator = <ComponentDecorator>makeDecorator(
export const Component: ComponentDecorator = makeDecorator(
'Component', (c: Component = {}) => ({changeDetection: ChangeDetectionStrategy.Default, ...c}),
Directive);
@ -724,8 +724,7 @@ export interface Pipe {
* @stable
* @Annotation
*/
export const Pipe: PipeDecorator =
<PipeDecorator>makeDecorator('Pipe', (p: Pipe) => ({pure: true, ...p}));
export const Pipe: PipeDecorator = makeDecorator('Pipe', (p: Pipe) => ({pure: true, ...p}));
/**

View File

@ -191,4 +191,4 @@ export interface NgModule {
* @Annotation
*/
export const NgModule: NgModuleDecorator =
<NgModuleDecorator>makeDecorator('NgModule', (ngModule: NgModule) => ngModule);
makeDecorator('NgModule', (ngModule: NgModule) => ngModule);