Skip to content

[@types/ember bug] - set() is not the same as this.set() #308

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

Closed
1 task done
nightire opened this issue Sep 15, 2018 · 2 comments · Fixed by DefinitelyTyped/DefinitelyTyped#28915
Closed
1 task done
Assignees
Labels
bug types:core Something is wrong with the Ember type definitions

Comments

@nightire
Copy link

nightire commented Sep 15, 2018

Which package(s) does this problem pertain to?

  • @types/ember

What are instructions we can follow to reproduce the issue?

import EmberObject, { set } from '@ember/object';

export class Foo extends EmberObject {
  name!: string;

  changeName(name: string) {
    set(this, 'name', name);
  }
}

Now about that bug. What did you expect to see?

It is expected to has no errors.

What happened instead?

Typescript throws an error:

Argument of type 'string' is not assignable to parameter of type UnwrapComputedPropertySetter<this["name"]>'.

Note

  1. use name: any instead of name: string, error will be gone
  2. use this.set instead of set(), error will be gone
@nightire nightire changed the title [@types/ember bug] - <YOUR_DESCRIPTION_HERE> [@types/ember bug] - get() is not the same as this.get() Sep 15, 2018
@nightire nightire changed the title [@types/ember bug] - get() is not the same as this.get() [@types/ember bug] - get() is not the same as this.get() Sep 15, 2018
@mike-north mike-north added bug types:core Something is wrong with the Ember type definitions labels Sep 15, 2018
@mike-north mike-north assigned mike-north and unassigned mike-north Sep 15, 2018
@mike-north mike-north changed the title [@types/ember bug] - get() is not the same as this.get() [@types/ember bug] - set() is not the same as this.set() Sep 15, 2018
mike-north added a commit to mike-north/DefinitelyTyped that referenced this issue Sep 15, 2018
mike-north added a commit to mike-north/DefinitelyTyped that referenced this issue Sep 15, 2018
@mike-north
Copy link
Contributor

Fix is ready for merge here DefinitelyTyped/DefinitelyTyped#28915

New @types/ember@~3.0 version should be cut early next week

RyanCavanaugh pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Sep 17, 2018
- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [x] Test the change in your own code. (Compile and run.)
- [x] Add or edit tests to reflect the change. (Run with `npm test`.)
- [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
- [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
- [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).

If changing an existing definition:
- [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://www.emberjs.com/api/ember/3.4/functions/@ember%2Fobject/set
- [x] Increase the version number in the header if appropriate.
- [x] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`.

---
- Fixes typed-ember/ember-cli-typescript#308
- Workaround due to breaking change microsoft/TypeScript#26120
- Would much much cleaner w/ a fix for microsoft/TypeScript#27014
@mike-north
Copy link
Contributor

Released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug types:core Something is wrong with the Ember type definitions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants