FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
963 stars 67 forks source link

angular2 with ui-router and typescript examples not running and throwing errors #137

Open mattiLeBlanc opened 8 years ago

mattiLeBlanc commented 8 years ago

I have just created the Hello World and landing page example and both trigger JS errors in console:

ERROR in /Users/matti/www/angular2/node_modules/ui-router-ng2/ng2/uiRouterNgModule.d.ts
(3,10): error TS2305: Module '"/Users/matti/www/angular2/node_modules/@angular/core/index"' has no exported member 'NgModuleMetadataType'.

ERROR in ./src/app/routes.ts
(19,42): error TS2345: Argument of type '() => TransitionPromise' is not assignable to parameter of type 'string | (($injector: $InjectorLike, $location: LocationServices) => string)'.
  Type '() => TransitionPromise' is not assignable to type '($injector: $InjectorLike, $location: LocationServices) => string'.
    Type 'TransitionPromise' is not assignable to type 'string'.

ERROR in ./src/app/index.ts
(13,3): error TS2345: Argument of type '{ imports: typeof BrowserModule[]; declarations: typeof MainComponent[]; providers: (any[] | Type...' is not assignable to parameter of type 'UIRouterModuleMetadata'.
  Object literal may only specify known properties, and 'imports' does not exist in type 'UIRouterModuleMetadata'.
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.89 kB       0

Also the 'npm run serve' just shows a 'loading...' screen on localhost:3000 Any idea what is going on?

I choose: Angular2 Typescript Browsersync ui-router

mindonline commented 8 years ago

Same problem. My build is: Angular2 Typescript Webpack ui-router

Garcia-Cesar commented 8 years ago

A little late, but I had the same issue. For Error TS2305, seems that the ui-router version that is installed was beta.2, which is causing that issue. Check you package.json to see which version of ui-router you are using. You should remove ui-router and make sure that you are using the beta.3 version and that fixed it for me. Source: https://github.com/FountainJS/generator-fountain-webapp/issues/142

KaterynaKateryna commented 7 years ago

This issue is still present. However, currently the version of UIRouter installed is 1.0.0-beta4 and the errors are slightly different:

ERROR in ./src/app/routes.ts (17,14): error TS2339: Property 'urlRouterProvider' does not exist on type 'UIRouter'.

ERROR in ./src/app/index.ts (16,45): error TS2345: Argument of type '{ states: Ng2StateDeclaration[]; configClass: typeof MyUIRouterConfig; }' is not assignable to parameter of type 'RootModule'. Object literal may only specify known properties, and 'configClass' does not exist in type 'RootModule'.

ERROR in .//ui-router-ng2/lib/uiRouterNgModule.js Module not found: Error: Can't resolve '@angular/router/src/router_config_loader' in '/{local_path}/node_modules/ui-router-ng2/lib' @ .//ui-router-ng2/lib/uiRouterNgModule.js 6:0-66 @ .//ui-router-ng2/lib/index.js @ ./src/app/index.ts @ ./src/index.ts

Switching to 1.0.0-beta3 helps.

matthewparton commented 7 years ago

change this line from configClass: MyRootUIRouterConfig

to

"config: \<any>MyRootUIRouterConfig"

dont ask me why wouldnt compile until i did this and then it started working

micfan commented 7 years ago

will be fixed in https://github.com/FountainJS/generator-fountain-webapp/issues/201