-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
angularjs/angular.d.ts $routeConfig #9122
Comments
@mmiszy removed it with the following reason:
The thing is, |
@rvl @SebastianSchenk As a workaround you can easily add it on your own in your project – you have some kind of |
Thanks @mmiszy. The third option is to just keep the old version of |
While the issue with declare namespace angular {
interface IComponentOptions {
$routeConfig?: any[];
}
} I have another issue: const MyComponent: IComponentOptions = {
templateUrl: "my.component.html",
$routeConfig: routeConfig,
bindings: { $router: '<' },
controllerAs: "model",
controller: MyComponentController
};
The workaround I use is declaring const bindings: {[bindngs: string]: string} = { $router: '<' };
const MyComponent: IComponentOptions = {
templateUrl: "my.component.html",
$routeConfig: routeConfig,
bindings: bindings,
controllerAs: "model",
controller: MyComponentController
}; |
What TypeScript version do you use @mickeyvip ? It sounds like a bug in TypeScript that I have mentioned here: #8150 (comment) |
@mmiszy , I'm on |
@mickeyvip are you sure that's the version you're using? I tested your code and I don't get any errors, as expected. |
@mmiszy, I just recreated the issue happening in my code. Indeed, as you pointed out, when I have: const MyComponent: IComponentOptions = {
templateUrl: "my.component.html",
$routeConfig: routeConfig,
bindings: { $router: '<' },
controllerAs: "model",
controller: MyComponentController
}; it compiles OK. But I had several code changes and extracted const bindings = { $router: '<' };
const MyComponent: IComponentOptions = {
templateUrl: "my.component.html",
$routeConfig: routeConfig,
bindings: bindings,
controllerAs: "model",
controller: MyComponentController
}; And now the compilation fails, unless I have explicitly set type on const bindings: {[bindngs: string]: string} = { $router: '<' }; Am I doing something wrong here? |
@mickeyvip thanks for a very detailed explanation :) You're not doing anything wrong here, and there's nothing wrong with |
@mmiszy, thank you. |
I know this is an old thread, but for whoever come over this again the above solution is wrong because you loosing types. The correct solution is
|
I have a silly question, I install both cc @mickeyvip @mmiszy (sorry for interuption). EDIT : Ugh, seems I need to use
On top of the files to have autocomplete... Sorry for interuption. Thank you |
angularjs/angular.d.ts
file in this repo and had problems.angularjs/angular.d.ts
.During the last changes of angular.d.ts the property $routeConfig of the IComponentOptions interface was removed. I don't really understand why, since it is the recommended way to define routes with the new component router (https://code.angularjs.org/1.5.5/docs/guide/component-router)
Could you re-include this property please?
The text was updated successfully, but these errors were encountered: