-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
hey - loving playing around with the lib right now, really well designed!
i was having a small issue when playing with sub-traits inheriting multiple super-traits - namely that it only takes the first trait supplied to augment the base class typings. i.e. given this README example:
// Define regular sub-trait Foo, inheriting from super-traits Bar and Qux.
const Foo = trait([ Bar, Qux ], (base) => class Foo extends base { ... })
// ============
i'd expect base
to give the correct typings for Bar
and Qux
, however that doesn't seem to be the case:
const Bar = trait((base) => {
return class Bar extends base {
dispose() {
console.log('Bar.dispose()');
}
};
});
const Qux = trait((base) => {
return class Qux extends base {
create() {
console.log('Qux.create()');
}
};
});
const Foo = trait([Bar, Qux], (base) => {
return class Foo extends base {
constructor() {
super();
this.dispose(); // typed correctly, since `base` is `typeof Bar`
this.create(); // `any` type
}
};
});
int0h
Metadata
Metadata
Assignees
Labels
No labels