{"action":"closed","issue":{"url":"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/75","repository_url":"https://api.github.com/repos/typed-ember/ember-cli-typescript","labels_url":"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/75/comments","events_url":"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/75/events","html_url":"https://github.com/typed-ember/ember-cli-typescript/issues/75","id":262414816,"number":75,"title":"Casting Ember.inject.service() resolutions","user":{"login":"perlun","id":630613,"avatar_url":"https://avatars2.githubusercontent.com/u/630613?v=4","gravatar_id":"","url":"https://api.github.com/users/perlun","html_url":"https://github.com/perlun","followers_url":"https://api.github.com/users/perlun/followers","following_url":"https://api.github.com/users/perlun/following{/other_user}","gists_url":"https://api.github.com/users/perlun/gists{/gist_id}","starred_url":"https://api.github.com/users/perlun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perlun/subscriptions","organizations_url":"https://api.github.com/users/perlun/orgs","repos_url":"https://api.github.com/users/perlun/repos","events_url":"https://api.github.com/users/perlun/events{/privacy}","received_events_url":"https://api.github.com/users/perlun/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-10-03T12:50:32Z","updated_at":"2017-11-13T17:09:50Z","closed_at":"2017-11-13T17:09:50Z","author_association":"CONTRIBUTOR","body":"Hi,\r\n\r\nThanks for an excellent addon - eagerly awaiting the next steps of development here.\r\n\r\nI have a usage question: how can I formulate some code like this and get it to properly understand that `this.store` is indeed of the `DS.Store` type?\r\n\r\n```typescript\r\nclass WorkspaceService extends Ember.Object {\r\n    session = Ember.inject.service();\r\n    store = Ember.inject.service();\r\n\r\n    someMethod() {\r\n        // The line below will generate a compilation error\r\n        this.store.findRecord('workspace', 1);\r\n    }\r\n```\r\n\r\nI _can_ do like this, which gets incredibly ugly and type-unsafe. But what better way could there be? (unless creating this object outside of Ember and passing in the `store` instance as a constructor parameter or similar...)\r\n\r\n```typescript\r\n    someMethod() {\r\n        let store = <DS.Store><any>this.store;\r\n        this.store.findRecord('workspace', 1);\r\n    }\r\n```\r\n"}}
{"actor":{"display_login":"chriskrycho"}}