-
-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
I'm submitting a feature request
- Library Version:
1.7.3
Please tell us about your environment:
-
Operating System:
Windows 10 -
Node Version:
v8.11.1 -
Yarn Version:
1.5.1 -
Language:
TypeScript 3.0
Current behavior:
We do not get any type safety when using @computedFrom. A few blogs give users a method for extending @computedFrom manually, but why not just make this an upstream feature we can use?
What is the expected behavior?
That @computedFrom can give us type safety out-of-the-box.
Example:
import {computedFrom as originalComputedFrom} from "aurelia-framework";
export function computedFrom<T>(...rest: Array<keyof T>) {
return originalComputedFrom(...rest);
}import {computedFrom} from './typedcomputedfrom';
export class App {
public foo = "a";
public bar = "b";
@computedFrom<App>("foo")
public get foobar () {
return `${this.foo} ${this.bar}`;
}
}What is the motivation / use case for changing the behavior?
- More bugs can be caught at compile-time, this will reduce chance of "typo" mistakes when using @computedFrom
- Rather than individual projects adopt this pattern and import a "fake" version of @computedFrom across their codebase, it's standard.
Metadata
Metadata
Assignees
Labels
No labels