-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no mapping for this #12507
Comments
What are the definitions of The following works but may not be what you are trying to accomplish Object.defineProperty(Object.prototype, 'proxify', {
get: function (this: any) {
// creating a proxy for the darn object
}
});
const data = {
name: 'hey',
value: 123
};
const proxy = data.proxify();
declare global {
interface Object {
proxify(): {
[P in keyof this]: Proxied<this[P]>;
};
}
}
export type Proxied<T> = {
[P in keyof T]: Proxied<T[P]>;
}; |
For the sake of argument, isn't a proxy supposed to be transparent? 😛 |
it doesnt really matter what dont remember anythhing about them having to look exactly like the original objects (although it wont hurt if they do) afaict, the only thing proxy should do to be standing between your object and you |
|
I was being somewhat facetious. Seriously though it does appear that mapping |
haven't you seen |
I've seen it a number of times but only in type aliases and other contexts where this would not be available. declare global {
interface Object {
proxify(): {
[P in keyof this]: Proxied<this[P]>;
};
}
} Doesn't give me that error. |
say |
This is probably the same problem as #12349 |
@HerringtonDarkholme Thanks for providing the clarifying context, it is very helpful. I had totally forgotten that you had already raised an issue requesting this behavior, and I didn't realize the implications, or consider this the same issue.
I suggest we move any further discussion (back) into #12349. |
This is not the same as #12349. these are two different issues. the thing is internally, all objects get the apparent members of |
i want to extend the Object prototype by adding a method that returns a proxified version of any object
what am i doing wrong?
The text was updated successfully, but these errors were encountered: