Skip to content
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

Typescript error: Property 'assign' does not exist on type 'ObjectConstructor' for Line 146 and Line 147 #2

Closed
dasis opened this issue Jul 28, 2016 · 2 comments

Comments

@dasis
Copy link

dasis commented Jul 28, 2016

Line 146: this.settings = Object.assign(this.defaultSettings, this.settings);
Line 147: this.texts = Object.assign(this.defaultTexts, this.texts);

I added these lines to fix it on my end.
//Reference: microsoft/TypeScript#3889
interface ObjectCtor extends ObjectConstructor {
assign(target: any, ...sources: any[]): any;
}
declare var Object: ObjectCtor;

Typescript Version: 1.0.3.0
Not sure if the latest typescript would've fixed my issue :)

@softsimon
Copy link
Owner

I think you need the es6 polyfill for this.

@nicholasguyett
Copy link
Contributor

Object.assign does not exist in ES5, so you either need to

  • include a polyfill in your project (such as core-js)
  • OR configure your tsconfig to build for ES6 or ES2015 (this may require a new version of typescript, I'm not certain
  • OR include a type typings reference for ES6 libraries (this is what I am using in my current project as I have one browser to support that does not support the full ES6 syntax, but does support Object.assign and other new features)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants