andreypopp / andreypopp/autobind-decorator

boundMethod decorator might not be usable in Angular production builds

Aperta
#82 5 commenti 1 reazione 0 assegnatari Vedi su GitHub
help wanted
Lingua principale
JavaScript
Stelle
1.4k
Fork
65
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.