andreypopp/autobind-decorator
View on GitHubboundMethod decorator might not be usable in Angular production builds
Open
#82 opened on Dec 13, 2018
help wanted
Description
I get this error when running production builds of my Angular app, which contains usages of the boundMethod decorator:
Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 3:22 in the original .ts file), resolving symbol boundMethod in C:/Users/Jeff/[path to my app]/node_modules/autobind-decorator/index.d.ts
I believe it is the Angular AoT compiler which is throwing this error. Devleopment builds, which don't use AoT, don't produce these errors.
I import the decorator using import { boundMethod } from "autobind-decorator";
A workaround is to use the autobind decorator instead, though that is discouraged by this package's docs.