JulioWar / jw-bootstrap-switch-ng2

Bootstrap Switch for Angular 2+
https://juliowar.github.io/jw-bootstrap-switch-ng2/
MIT License
43 stars 14 forks source link

AoT compilation returns error #4

Closed Hehohehoheho closed 7 years ago

Hehohehoheho commented 7 years ago

When I try compiling my project with AoT, it returns the following error:

 Error in bail mode: [at-loader] compiled\node_modules\jw-bootstrap-switch-ng2\src\directive.ngfactory.ts:246:59
TS2339: Property 'subscribe' does not exist on type 'boolean'.

Any idea on how I can fix this?

JulioWar commented 7 years ago

Hello @Lucasvo1. I guess you're using angular-cli, What version are you using?

rihardsgladisevs commented 7 years ago

@angular/cli: 1.0.0 node: 6.10.0 os: win32 x64

Have the same issue:

ERROR in C:/projects/ws/src/main/webapp/src/$$_gendir/node_modules/jw-bootstrap-switch-ng2/src/directive.ngfactory.ts (246,59): Property 'subscribe' does not exist on type 'boolean'. C:/projects/ws/src/main/webapp/src/$$_gendir/node_modules/jw-bootstrap-switch-ng2/src/directive.ngfactory.ts (420,45): Property '_disabled' is private and only accessible within class 'JWBootstrapSwitchDirective'.

JulioWar commented 7 years ago

Thanks @rihardsgladisevs I will review it as soon as possible.

JulioWar commented 7 years ago

Hello Guys @rihardsgladisevs @Lucasvo1

I check the code I made some changes. please update the npm package and let me know if it works. I will be in touch.

Hehohehoheho commented 7 years ago

Hi @JulioWar, I am getting the same error

[at-loader] Checking finished with 1 errors
Error in bail mode: [at-loader] compiled\node_modules\jw-bootstrap-switch-ng2\src\directive.ngfactory.ts:246:59
TS2339: Property 'subscribe' does not exist on type 'boolean'.
JulioWar commented 7 years ago

@Lucasvo1 I'm not getting that specific error.

Can you share the code of how you are initializing the switch? and What specific command you are using to compile with AoT?

I will try to replicate it.

rihardsgladisevs commented 7 years ago

H @JulioWar , I am getting the same error:

ERROR in C:/projects/ws/src/main/webapp/src/$$_gendir/node_modules/jw-bootstrap-switch-ng2/src/directive.ngfactory.ts (246,59): Property 'subscribe' does not exist on type 'boolean'

I call ng build --prod --aot for the build

Hehohehoheho commented 7 years ago

I am using the same command as the one posted by @rihardsgladisevs

JulioWar commented 7 years ago

Sorry Guys, I try to reproduce the error but nothing happen.

Please check this repository and maybe you can find something that I'm missing.

You can try to use the command build or serve within the repository.

Hehohehoheho commented 7 years ago

Could it have something to do with the get and set value?: https://github.com/JulioWar/jw-bootstrap-switch-ng2/blob/master/src/directive.ts#L409

rihardsgladisevs commented 7 years ago

@Lucasvo1 @JulioWar, may be we use different version of TypeScript or Angular, personally I use:

"dependencies": {
    "@angular/common": "2.4.10",
    "@angular/compiler": "2.4.10",
    "@angular/core": "2.4.10",
    "@angular/forms": "2.4.10",
    "@angular/http": "2.4.10",
    "@angular/platform-browser": "2.4.10",
    "@angular/platform-browser-dynamic": "2.4.10",
    "@angular/router": "3.4.10",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6",
    "bootstrap": "3.3.7",
    "ng2-bootstrap": "1.4.2",
    "angular2-grid": "2.0.2",
    "jw-bootstrap-switch-ng2": "0.0.7",
    "bootstrap-switch": "^3.3.4"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0",
    "@angular/compiler-cli": "2.4.10",
    "@types/core-js": "0.9.37",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "cpr": "2.0.2",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "^1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "reflect-metadata": "0.1.10",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
JulioWar commented 7 years ago

@rihardsgladisevs, can you check the version of the library, the last release is "0.0.8".

It would be very helpful if you could make a repository where you can only isolate what corresponds to this library.

FelipeCorso commented 7 years ago

Hi @JulioWar , I am getting the same error:

$ ng build --target=production --environment=prod                                                                                  
Hash: 4a418307ced22a5d1316                                                                                                         
Time: 32015ms                                                                                                                      
chunk    {0} polyfills.26c1302608fdd9e5aa41.bundle.js (polyfills) 232 kB {5} [initial] [rendered]                                  
chunk    {1} main.f599f8eaa8f7a9d755f0.bundle.js (main) 463 kB {4} [initial] [rendered]                                            
chunk    {2} scripts.16c98b08d19fe806811e.bundle.js (scripts) 38.8 kB {5} [initial] [rendered]                                     
chunk    {3} styles.84af3b2310f56ccbd29d.bundle.css (styles) 175 bytes {5} [initial] [rendered]                                    
chunk    {4} vendor.d01d0287b5c9236e4538.bundle.js (vendor) 1.5 MB [initial] [rendered]                                            
chunk    {5} inline.a8f2839c95b9093d1bc1.bundle.js (inline) 0 bytes [entry] [rendered]                                             

ERROR in C:/my-project/src/$$_gendir/node_modules/jw-bootstrap-switch-ng2/src/directive.ngfactory.ts (246,59): Property 'subscribe' does not exist on type 'boolean'.                                                    
JulioWar commented 7 years ago

Hello @FelipeCorso What is your version for nodejs, angular and this library ? Can you share some of your code of your component where you are using this library ?

FelipeCorso commented 7 years ago

Yes, of course. I will create an exemple and send the repository to you.

FelipeCorso commented 7 years ago

Hello @JulioWar I simulated the problem, and here is the repository https://github.com/FelipeCorso/jw-bootstrap-switch-ng2/tree/master/switch-project You need install the angular-cli, I followed this tutorial https://scotch.io/tutorials/use-the-angular-cli-for-faster-angular-2-projects Then execute npm install ng build -prod

JulioWar commented 7 years ago

Thanks @FelipeCorso.

I will review this repository as soon as possible.

JulioWar commented 7 years ago

Hey Guys, sorry for the delay, but I was trying to figure it out what was wrong in my code. Thanks to the StackOverflow community 😄.

I published the version 0.0.9 on npm.

Please let me know if it is resolved.