angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.54k stars 3k forks source link

Errors from core interface type definitions #3499

Closed gaui closed 7 years ago

gaui commented 7 years ago

This issue tracker is for Bug Reports and Feature Requests only. Please direct requests for help to StackOverflow. See http://bit.ly/UIR-SOF for details.

This is a:

My version of UI-Router is: (version)

1.0.5

Bug Report

Current Behavior:

When importing interfaces/types from core package @uirouter/core like this (it doesn't matter what you import):

import { StateService } from '@uirouter/core';

and running tsc yields the following compilation errors:

node_modules/@uirouter/core/lib/transition/interface.d.ts(732,5): error TS2411: Property 'to' of type 'string | boolean | Predicate<StateDeclaration> | undefined' is not assignable to string index type 'string | boolean | Predicate<StateDeclaration>'.

node_modules/@uirouter/core/lib/transition/interface.d.ts(734,5): error TS2411: Property 'from' of type 'string | boolean | Predicate<StateDeclaration> | undefined' is not assignable to string index type 'string | boolean | Predicate<StateDeclaration>'.

node_modules/@uirouter/core/lib/transition/interface.d.ts(736,5): error TS2411: Property 'exiting' of type 'string | boolean | Predicate<StateDeclaration> | undefined' is not assignable to string index type 'string | boolean | Predicate<StateDeclaration>'.

node_modules/@uirouter/core/lib/transition/interface.d.ts(738,5): error TS2411: Property 'retained' of type 'string | boolean | Predicate<StateDeclaration> | undefined' is not assignable to string index type 'string | boolean | Predicate<StateDeclaration>'.

node_modules/@uirouter/core/lib/transition/interface.d.ts(740,5): error TS2411: Property 'entering' of type 'string | boolean | Predicate<StateDeclaration> | undefined' is not assignable to string index type 'string | boolean | Predicate<StateDeclaration>'.

This means people can't use interfaces from the core package. I also tried to import it from @uirouter/angularjs instead, but got the same error.

I set up the following repo that reproduces the issue: https://github.com/gaui/uirouter-types-issue

Expected Behavior:

Should not yield any compilation errors.

Link to GitHub repo that reproduces the issue:

https://github.com/gaui/uirouter-types-issue

Feature Request

(feature request here)

General Query

Please direct general implementation questions to StackOverflow: http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router

Please review the Sample Application which highlights common approaches: https://github.com/ui-router/sample-app-ng1

(general query here)

christopherthielen commented 7 years ago

https://github.com/ui-router/core/issues/33