Ember: actually use Controller registry in controllerFor.

This commit is contained in:
Chris Krycho
2018-02-14 10:50:23 -07:00
parent 6d08c4cece
commit eb8cdf016c
2 changed files with 7 additions and 1 deletions

View File

@@ -1819,7 +1819,7 @@ declare module 'ember' {
* The controller instance must already have been created, either through entering the
* associated route or using `generateController`.
*/
controllerFor(name: string): Controller;
controllerFor<K extends keyof ControllerRegistry>(name: K): ControllerRegistry[K];
/**
* Disconnects a view that has been rendered into an outlet.

View File

@@ -5,6 +5,8 @@ class AuthService extends Ember.Service {
}
class ApplicationController extends Ember.Controller {
model: {};
string: string;
transitionToLogin() {}
}
@@ -29,6 +31,10 @@ class LoginRoute extends Ember.Route {
this.get('application').transitionToLogin();
}
}
anyOldMethod() {
this.controllerFor('application').set('string', 'must be a string');
}
}
// New module injection style.