-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I think it might be a good idea to expose this type.
Potential use-case:
import { trait, derive, derived, Derived } from "@traits-ts/core"
const HasA = trait(B => class extends B {
a = 'a';
});
function log(b: Derived<typeof HasA>) {
console.log(b.a);
}
Similar can be achieved like that:
function logWithCheck(b: any) {
if (derived(b, HasA)) {
console.log(b.a);
} else {
//throw maybe?
}
}
But then the function call would be untyped and impossible to do compile time check.
If the same can be solved somehow else I'd appreciate advice and updating docs (if it's not there yet)
Metadata
Metadata
Assignees
Labels
No labels