Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Proxy with TypeScript / Angular2

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?

like image 478
bythe4mile Avatar asked Mar 09 '16 20:03

bythe4mile


1 Answers

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.

like image 150
toskv Avatar answered Oct 06 '22 23:10

toskv