Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught reflect-metadata shim is required when using class decorators #854

Closed
cmermingas opened this issue Aug 12, 2016 · 0 comments
Closed

Comments

@cmermingas
Copy link

  • I'm submitting a ...
    [X] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
  • Do you want to request a feature or report a bug?
    Report a problem
  • What is the current behavior?
    I see error Uncaught reflect-metadata shim is required when using class decorators on the JavaScript console.
  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

One of my files is an AI player for a game and I want it to emit an event when it has decided its next move. So, I have this:

export class ConnectFourAiPlayerWebWorker {
  public nextMove = new EventEmitter<number>();

  constructor(public worker: Worker, public playerNumber: number) {
    worker.onmessage = (event: MessageEvent) => this.turnTaken(event);
  }

  takeTurn() {
    this.worker.postMessage('TAKE_TURN');
  }

  turnTaken(event: MessageEvent) {
    this.nextMove.emit(event.data);
  }
}

It was working until I added public nextMove = new EventEmitter<number>();. It then started giving this error in the browser's console: connect-four-ai-player-worker-wrapper.ts?21e7:3 Uncaught reflect-metadata shim is required when using class decorators

  • Please tell us about your environment:
  • Angular version: 2.0.0-rc.4
  • Browser: Chrome 52.0.2743.116
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

I checked #353 but couldn't relate to the exact same problem. Plus, I don't think I would have to change the Webpack configuration or import new packages just to use EventEmitter. So my guess is that something else is wrong and chances are it's user error :-) Thanks in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant