# no-new-symbol

Disallow constructing Symbol using new.

Symbol shouldn’t be constructed using new keyword since it results in a TypeError, instead it should be called as a function.

# Incorrect code examples

// This call results in TypeError
const fooSymbol = new Symbol("foo");

# Correct code examples

const fooSymbol = Symbol("foo");
More incorrect examples
new Symbol()
More correct examples
new SomeClass()

Source (opens new window)

Last Updated: 11/18/2020, 9:36:33 PM