uksz uksz - 1 year ago 313
TypeScript Question

Property 'assign' does not exist on type 'ObjectConstructor'

I am using TypeScript in my application, where I use function:

Object.assign(this.success, success.json())

However, during compilation, I receive the following error:

error TS2339: Property 'assign' does not exist on type 'ObjectConstructor'.

Do you have any idea how can I get rid of this error?


Answer Source

You can use type assertion, like this:

(<any>Object).assign(this.success, success.json())
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download