-
Notifications
You must be signed in to change notification settings - Fork 3k
Update from 1.0.0-beta.2 to 1.0.0-beta.3 brings TS errors #3070
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
Comments
I fixed this by removing the 'readonly' params from stateService.d.ts locally to get my build working. It looks like this is a typescript 2.0 propert, so if your not using ts 2.0. This will freak out. |
My app with requirejs show:
in angular-ui-router.js file, line 6625 where:
|
@artaommahe yes, this is because we build with typescript 2.0. Unfortunately building with 2.0 broke backwards compatibility for us. Angular 2 team also builds with typescript 2.0. They have a build step (in brocolli) where they strip the Typescript 2.0 is now final, but I don't think that means all users should upgrade immediately. Maybe we can do something similar before publishing to strip out the |
@christopherthielen do you know how we might fix @elesdoar's issue? I'm having the same problem. Running angular 1/2 hybrid trying to upgrade from ui-router 0.3.x to 1.0.0-beta.3 just for the ng1 portion. |
@christopherthielen I'm using webpack to load it and angular. ui-router is loading after angular but I'm still getting this issue for some reason. Do you know if 0.3.x also used UMD? I narrowed it down a little on our end. I got the same error when attempting to upgrade an old version of our app before we started switching to typescript and angular 2. |
@epelc 1.0 is bundled using webpack. 0.3.x is using a hand-made UMD-like surround, but I think it's not full UMD: https://github.com/angular-ui/ui-router/blob/legacy/Gruntfile.js#L23-L29 ui-router umd code can be seen at the top of the bundle: https://unpkg.com/[email protected]/release/angular-ui-router.js where it depends on (requires) (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("angular"));
else if(typeof define === 'function' && define.amd)
define("angular-ui-router", ["angular"], factory);
else if(typeof exports === 'object')
exports["angular-ui-router"] = factory(require("angular"));
else
root["angular-ui-router"] = factory(root["angular"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_57__) {
return /******/ (function(modules) { // webpackBootstrap If you can publish an example to github or something I can take a look. However, this should be moved to a different issue, since it's unrelated to the original issue reported about Typescript. |
Fixed by c8162ee |
Am I required to use webpack for 1.0 beta? I tried loading with requirejs and get this angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module admin due to:
Error: [$injector:modulerr] Failed to instantiate module ui.router due to:
Error: [$injector:nomod] Module 'ui.router' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. |
Nope, requirejs should work. We ship a UMD bundle which should be compatible with requirejs, as far as I know. I've never used requirejs, however. |
By ship a UMD bundle you mean Sorry stuck where to look. |
@dustinsmith1024 We publish (ship) to NPM and Bower. The URL you linked is a CDN for NPM. Yes, the linked file is the UMD bundle and it should work. However, I suggest you retrieve the package using a package manager (npm or yarn preferred)
Can you provide any other details about how you're trying to integrate ui-router using requirejs? Assume I don't know anything about your setup. |
I got it working. We had a requirejs shim in place before and I had to remove that and reference the |
I'm using TypeScript 1.8.9 with ng1 and webpack. Update to beta.3 brings this
The text was updated successfully, but these errors were encountered: