Skip to content

Instantly share code, notes, and snippets.

@twerske
Created May 13, 2022 20:24
Show Gist options
  • Save twerske/3f5d95c08fea9e9ee07ad0e69cdd018f to your computer and use it in GitHub Desktop.
Save twerske/3f5d95c08fea9e9ee07ad0e69cdd018f to your computer and use it in GitHub Desktop.
Tree-shakeable error messages
@Component({...})
class MyComponent {}
@Directive({...})
class MyDirective extends MyComponent {} // throws an error at runtime
// Before v14 the error is a string:
> Directives cannot inherit Components. Directive MyDirective is attempting to extend component MyComponent.
// Since v14 the error code makes this tree-shakeable:
> NG0903: Directives cannot inherit Components. Directive MyDirective is attempting to extend component MyComponent.
// v14 production bundles preserve the error code, tree-shaking strings and making the bundle XX smaller:
> NG0903
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment