This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Capturing Variables #13
Labels
Comments
Ok so far the brainstorming:
NOTE: If you just have a primitive at root level for instance, you can still resolve captured params to the |
A bit of code and a lot of playing around with the type system and it seems that the type system in Typescript won't hold up for the previous design. The root of the problem is that:
Capture Design 2.0I started designing a new approach last night, it goes like this:
Still Unsure About:
interface x {
x: number;
}
interface x2 {
x: string;
}
type y = x & x2; And it seems that y is now an impossible type. It forced x to be both a string and a number. This means that the capture map cannot overwrite values, this may be a problem, I'm not sure yet.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Sometimes in our imperative-messes we do get the usefulness of "capturing" variables so if we need them we don't need to re-query.
To give an example, when we query the database to check if a users password is good (in the restriction), it's useful to "capture" that user so if it is good we can return that user. At the moment, this cant be done with the library, you can though put a
let user: User
at the top and capture it yourself, but that's ugly and is coupling the schema to random external lines of code.The plan is to allow capturing through the
resolve
, the benefit being we can stay at one method, it doesn't make things much more complicated, and now we can just resolve with whatever we want as opposed to void.Also, it should work with nesting nicely, so I'll have to think about how exactly to do this. Eg. An outer restriction requiring a variable from an inner restriction.
The text was updated successfully, but these errors were encountered: