Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript Duplicate identifier 'Node'

Tags:

typescript

When compiling the following typescript:

class Node {
}

It works in the playground but not using VS2013 or grunt-typescript which generates the error

TS2000: Duplicate identifier 'Node'

I guess it can only be because its a reserved word but I have searched the typescript spec for reserved words and can't find any. Is there a list available and why is such a common class name reserved?

like image 871
daw Avatar asked Dec 28 '25 16:12

daw


1 Answers

Node is already an object in JavaScript. It's not a reserved word, but it is a built-in thing that you don't want to accidently overwrite at runtime (you would break other libraries).

> Node.prototype
    Node {insertBefore: function, replaceChild: function, removeChild: function, appendChild: function, hasChildNodes: function…}
like image 91
Ryan Cavanaugh Avatar answered Dec 31 '25 04:12

Ryan Cavanaugh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!