Steps to reproduce:
- Create a new ember app
- Install
ember-cli-typescript
ember g route home
- Replace your home route's code with something like this
import Route from "@ember/routing/route";
export default class Home extends Route {
public tool = "ember-cli";
public model(): any {
return ["ember", "ember-data", this.get("tool")];
}
protected foo() {}
}
What I expected
The presence of a private or protected foo() {} method should not cause other methods in the class to break. I should be free to call foo() from other public, private or protected methods, and see behavior in alignment with the way things work in vanilla TypeScript classes.
What I saw instead
Compilation error on the this.get("tool"):
[ts]
The 'this' context of type 'this' is not assignable to method's 'this' of type 'ComputedPropertyGetters<{ tool: string; model: () => any; foo: () => void; afterModel: (resolvedM...'.
Type 'Home' is not assignable to type 'ComputedPropertyGetters<{ tool: string; model: () => any; foo: () => void; afterModel: (resolvedM...'.
Property 'foo' is protected in type 'Home' but public in type 'ComputedPropertyGetters<{ tool: string; model: () => any; foo: () => void; afterModel: (resolvedM...'.
Related: #212 #176
Even if this is a "known limitation", we should track these kinds of things as bugs so they can be triaged and focused on appropriately. Two teams currently trying to adopt Ember+TS were questioning their own sanity for a few days last week, because they found no info (issues/PRs/documentation) that shed light on this.
Steps to reproduce:
ember-cli-typescriptember g route homeWhat I expected
The presence of a private or protected
foo() {}method should not cause other methods in the class to break. I should be free to callfoo()from other public, private or protected methods, and see behavior in alignment with the way things work in vanilla TypeScript classes.What I saw instead
Compilation error on the
this.get("tool"):Related: #212 #176
Even if this is a "known limitation", we should track these kinds of things as bugs so they can be triaged and focused on appropriately. Two teams currently trying to adopt Ember+TS were questioning their own sanity for a few days last week, because they found no info (issues/PRs/documentation) that shed light on this.