Skip to content

Latest commit

 

History

History

plugin-remove-useless-constructor

@putout/plugin-remove-useless-constructors NPM version

Wrapper classes have surprising behaviour, such as new Boolean(false) evaluating to true.

(c) Google TypeScript Style Guide

🐊Putout plugin adds ability to remove useless constructors. Use with remove-useless-new.

Install

npm i @putout/plugin-remove-useless-constructors

Rule

{
    "rules": {
        "remove-useless-constructors": "on"
    }
}

❌ Example of incorrect code

const s = String('hello');
const b = Boolean(false);
const n = Number(5);

✅ Example of correct code

const s = 'hello';
const b = false;
const n = 5;

License

MIT