xandermonkey
xandermonkey

Reputation: 4422

TSLint autofix deprecations from util

I'm wondering if there's a way in VSCode to autofix deprecations from the util library.

Example:

if (isNullOrUndefined(this.api)) {

Should be:

if (this.api === null || this.api === undefined) {

There is no autofix option, only a rule disablement option... but the hovertext shows the fix!

Upvotes: 0

Views: 164

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65453

No. The autofixes you see in VS Code come from TSLint. Auto fixing deprecated apis is not supported currently and would require a fix in TSLint itself.

The complete list of auto-fixable tslint rules is here (auto fixable ones are indicated by has-fixer)


To replace these node apis, the safest change would be to write your own isNullOrUndefined function (or find one from npm) and switch all callers to use it instead of the node version

Upvotes: 1

Related Questions