Skip to content

[@types/ember bug] - Ember.set doesn't work w/ ES6 classes #286

Closed as not planned
@mike-north

Description

@mike-north

Which package(s) does this problem pertain to?

  • @types/ember

What are instructions we can follow to reproduce the issue?

Failing test case
class Foo extends Ember.Object.extend({
    a: Ember.computed({
        get() { return ''; },
        set(key: string, newVal: string) { return ''; }
    })
}) {
    b = 5;
    baz() {
        let y = this.b; // $ExpectType number
        let z = this.a; // $ExpectType ComputedProperty<string, string>
        this.b = 10;
        this.get('b').toFixed(4); // $ExpectType string
        this.set('a', 'abc').split(','); // 💥 $ExpectType string[]
        this.set('b', 10).toFixed(4); // 💥 $ExpectType string

        this.setProperties({ b: 11 }); // 💥
        // this.setProperties({ b: '11' }); // 💥 $ExpectError
        this.setProperties({ // 💥
            a: 'def',
            b: 11
        });
    }
}

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

I expected to be able to set properties on my ember objects with no type errors

Metadata

Metadata

Assignees

Labels

bugtypes:coreSomething is wrong with the Ember type definitions

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions