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

Documentation and typings do not match #3538

Closed eseliger closed 7 years ago

eseliger commented 7 years ago

This is a:

My version of UI-Router is: 1.0.6

Bug Report

The documentation says here in the text that every value in the views object must be a Ng1ViewDeclaration. Although, in the example a string is used as well, which works. But the type for views is

views?: {
    [key: string]: Ng1ViewDeclaration;
}

I think the type of values should be Ng1ViewDeclaration | string

Also in StateDeclaration, the return type of redirectTo currently is

RedirectToResult | ((transition: Transition) => Promise<RedirectToResult>);

although the documentation says here it can either be a RedirectToResult, or a function returning either a Promise or a RedirectToResult. So I think it should be

RedirectToResult | ((transition: Transition) => RedirectToResult | Promise<RedirectToResult>);

See also here in core