Skip to main content

All Questions

Tagged with
0 votes
0 answers
21 views

Typescript derives different types when a static method is called from inside or outside a class

Can someone help me explain the behavior of typescript in this example. I have no idea what is going on here. Why is childProxy1.foo not resolved while childProxy2.foo is resolved correctly? Why is ...
Micha Stubi's user avatar
-1 votes
1 answer
52 views

Why is Proxy being called for nested elements?

I'm attempting to abstract some Cypress methods into a helper object using getters. The intended behavior is that I can do something like this: todoApp.todoPage.todoApp.main.rows.row .first()....
user3534080's user avatar
  • 1,405
0 votes
1 answer
616 views

Typescript: function should return proxy object of generic object type

The following function should create a proxy object with a specific handler, but typescript is throwing a type error when I try it that way. function createProxiedObject<T extends object>(obj: T)...
Arber's user avatar
  • 521
1 vote
1 answer
233 views

Implement a dynamic lazy proxy collection class on typescript

I'm trying to implement a lazy database connection collection in typescript. I'm creating a class called DatabaseCollection and my idea is to use a proxy to lazy load the connections (I'm using knex ...
Felipe Buccioni's user avatar
0 votes
1 answer
840 views

TypeScript types for Proxy with dynamic properties

I want to type a JavaScript Proxy that allows access to arbitrary properties. A contrived example, an object that maps every property to it's own property name: const proxy = new Proxy({}, {   get(...
tlrobinson's user avatar
  • 2,838
0 votes
0 answers
1k views

property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value

I want interception object with proxy,but I can’t understand why I report an error function createReactiveObject(target) { if (!isObject(target)) { return target; } return ...
magician wang's user avatar
1 vote
1 answer
827 views

Javascript proxy for nested object (apply for all function calls)

I'm looking for away to use a proxy on a nested object. In this example I would like to add 1 in my proxy for the result of every function call in that object. How would I go about this, since I can't ...
Jan Schmutz's user avatar
1 vote
0 answers
527 views

trying to set Proxy trap for a nested object. succeeded intercession except array.unshift and array.splice and some others

i am trying to make a Proxy trap for a nested object (kinda trying to implement vuex reactive). kinda succeeded in setting trap following this post: How to use javascript proxy for nested objects my ...
Inu Jung's user avatar
  • 160
-1 votes
1 answer
1k views

Use Proxy on Class while maintaining access to existing properties and class type

In an effort to learn how Proxy works I wanted to try and make a Proxied class that can handle any property name, even those that don't exist in the class, while still maintaining access to old ...
valepu's user avatar
  • 3,295
0 votes
1 answer
120 views

Is there a way to describe type for Proxy based on modified properties in typescript

I have a list of routes: export interface RouteMap { routeA: string; routeB: string; routeC: string; ... } const routesMap: RouteMap = { routeA: 'route-a-url', routeB: 'route-b-url/:...
RQman's user avatar
  • 469
0 votes
1 answer
522 views

Weird issue about JavaScript Proxy and getter functions

The two test cases blow both pass. I simply don't understand the behavior. It seems that JavaScript Proxy cannot trap property getting inside a getter function. test('JS Proxy normal method', () => ...
Tyler Liu's user avatar
  • 20.1k
0 votes
1 answer
27 views

Create a construct that evaluates to a string and can have other strings as properties

I'd like to make particular JavaScript construct, with appropriate TypeScript typings I want my construct to: return a string when evaluated have properties that return different strings when ...
Michal Kurz's user avatar
  • 1,943
0 votes
1 answer
363 views

ES6 Proxy: set property trap with debounce, is it possible to avoid dictionary of callbacks?

Goal: get any changed form field as 'name-value' pair on user input with debounce while typing. Sample template (person is two-way binded model). <form> <q-input v-model="person....
Arsync's user avatar
  • 425
1 vote
2 answers
88 views

Registering property changes of an object from another object

In my project, I have a widgetBar that can contain one or more widgets. When clicking on the widget icon in the widgetBar, a panel is opened to show the conent of the pressed widget (kind of a ...
umbe1987's user avatar
  • 3,284
0 votes
0 answers
339 views

Get property type from setter on proxy class Typescript

I'm stuck in a problem. I'm creating a proxy for my BaseModel Class that have the base methods to interact with mongoose in a type way. In my case I need get the type of the property to be setted to ...
Rodrigo Alcorta's user avatar

15 30 50 per page