13

I came across this article on programming with proxies in ES6 and Proxy seemed to be the best way to go about a problem I was trying to solve. However I can't seem to find the Proxy class anywhere in either TS or Angular2 (Not that I expected an ES6 spec to be implemented there).

Searching online as well didn't seem to provide any good answers on how to use Proxy with TS. So am I missing something? And if its not a part of the core TypeScript library is there any other library that I can use in conjunction to avail this?

1 Answer 1

7

The Proxy class was defined in ES6.

If you want to use it in TypeScript you have to set the output target to be ES6 javascript.

In order to additions to the ES6 standard library when compiling to ES5 you can usually use Core.js. Sadly it doesn't offer a polyfill for this.

Sign up to request clarification or add additional context in comments.

2 Comments

So that gets us past step 1 and then we have to enable experimental ES6 features in chrome to actually use it. I suppose I have to wait till the day this becomes a part of mainstream chrome to actually build something constructive on it. Thanks for pointing out in the right direction!
@DanDart if you have an example with that it would be great to add it as an answer even if it's not the accepted answer it might help people. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.