18

chrome console error: Uncaught ReferenceError: __decorate is not defined this is code https://github.com/Dreampie/angular2-demo

run it:

npm install

npm run typings install

npm run start

open localhost:80 in browser

someone help?

Dreampie
  • 1,321
  • 4
  • 17
  • 32

2 Answers2

41

remove from tsconfig.json

"declaration": true,
"noEmitHelpers": false,
"isolatedModules": false
Dreampie
  • 1,321
  • 4
  • 17
  • 32
  • 9
    Great! In my case, the `noEmitHelpers` was the culprit, the others weren't in my `tsconfig.json` file to begin with. – Sandor Drieënhuizen May 24 '16 at 17:06
  • I'm on RC5. I added "declaration": true because i had __extends not defined. In other thread issue #16 mentioned to add "declaration": true. If i have declation i get __decorate is not defined. If i remove everything mentioned above i get back __extends not defined. – user1501382 Oct 06 '16 at 12:03
  • 6
    Can you elaborate on what this is actually doing/how these were causing this problem? not a lot of help otherwise – Fiddles Mar 03 '17 at 15:11
  • Damn you are a wizard :) – onalbi Mar 05 '17 at 19:17
  • See https://www.typescriptlang.org/docs/handbook/compiler-options.html for what these do. declaration (default false) - Generates corresponding .d.ts file noEmitHelpers (default false) - Do not generate custom helper functions like __extends in compiled output. isolatedModules (default false) - Transpile each file as a separate module – Nate Loftsgard May 09 '18 at 19:34
2

This happened to me when creating the code sharing NativeScript https://docs.nativescript.org/angular/code-sharing/intro

but I only had to coment out this 2 lines:

    //"declaration": false,  
    //"noEmitHelpers": true, 
Pablo Gutierrez
  • 112
  • 1
  • 4
  • 3
    Thanks, happened to me, too, removing `"noEmitHelpers": true` was sufficient. I opened an issue: https://github.com/NativeScript/nativescript-schematics/issues/304 – Esteban Gehring Oct 22 '20 at 09:43
  • 1
    I just had the same issue but I wasn't sure if the NativeScript mobile part of the shared app needs the `"noEmitHelpers": true,` so instead I put `"noEmitHelpers": false,` into the **"tsconfig.app.json"** file so it would only affect the typescript compiler options of the web browser portion of the project which also fixed this issue. – RcoderNY Oct 26 '20 at 19:33