Upgrading to ui-router 1+ – Typings errors

Issue

I’m upgrading an AngularJS (1.5) app from ui-router 0.2.18 to @uirouter/angularjs 1.0.7 and I’m getting, what I assume are, typings errors.

Everything was fine before, but now it just won’t work.

Errors:

ERROR in /node_modules/@uirouter/core/lib/transition/transition.d.ts
(421,59): error TS2304: Cannot find name 'undefined'.

ERROR in
/node_modules/@uirouter/core/lib/transition/interface.d.ts
(744,41): error TS2304: Cannot find name 'undefined'.

ERROR in
/node_modules/@uirouter/core/lib/common/coreservices.d.ts
(10,62): error TS2304: Cannot find name 'never'.

ERROR in
/node_modules/@uirouter/core/lib/path/pathNode.d.ts
(59,61): error TS1110: Type expected.

ERROR in
/node_modules/@uirouter/core/lib/common/common.d.ts
(10,14): error TS2304: Cannot find name 'object'.

package.json:

"devDependencies": {
    "@uirouter/angularjs": "^1.0.7",
    "angular": "1.5.0",

    ...

    "typescript": "1.8.10"

    ...
    }

tsconfig:

{
"compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "moduleResolution": "node"
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false },
"filesGlob": [
    "**/*.ts"
]

}

Module initialisation:

...
import uiRouter from '@uirouter/angularjs';
...

angular
    .module('app', [
        ...
        uiRouter
        ....
    ]);

Solution

OK, solved it. I updated TypeScript to version 2+.

Silly, really.

Answered By – user7043436

Answer Checked By – David Goodson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.