Skip to content

[unicorn/no-typeof-undefined]: wrong changes #2708

@splincode

Description

@splincode

In our project we use CloseWatcher

function getWatcher(): CloseWatcher {
    // @ts-ignore
    return typeof CloseWatcher === 'undefined' ? {destroy: () => {}} : new CloseWatcher();
}

After npx eslint . --fix

// @ts-ignore
return CloseWatcher === undefined ? {destroy: () => {}} : new CloseWatcher();

But after that I have error when npx jest .

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions