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

Illegal constructor in JS #13531

Closed
sebab97 opened this issue Jan 17, 2017 · 1 comment
Closed

Illegal constructor in JS #13531

sebab97 opened this issue Jan 17, 2017 · 1 comment
Labels
Question An issue which isn't directly actionable in code

Comments

@sebab97
Copy link

sebab97 commented Jan 17, 2017

TypeScript Version: 2.1.4

Code

module graphics {

	export class Texture extends HTMLImageElement {

		constructor(src: string) {
			super();
			this.src = src;
		}

	}

}
/* another file */
var texture: Texture = new graphics.Texture('png/0.png');

`

/* tsconfig.json */
{
	"compilerOptions": {
		"outFile": "../public/js/app.js",
		"target": "es5"
	}
}

Expected behavior: Execute in browser without errors.

Actual behavior: TypeError: Illegal constructor.

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jan 17, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Jan 17, 2017

Please find more details in MDN on how custom elements work.

Also see #574 (comment)

@mhegazy mhegazy closed this as completed Apr 21, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants