Closed ElPrudi closed 1 year ago
Thatβs a good idea for a PR :)
This is absolutely same as in https://github.com/coderaiser/putout/issues/158: c23fa1e, dfc5954, 2540ecf
@ElPrudi how do you think checking of type should look like?
types/declare
already supports isObject()
, but we should remember that typeof null === 'object'
, so check should be more sophisticated, and Iβm not sure a lot people checks object
type in a similar way, what do you think?
And same question about !isObject()
to what code is should be applied?
Maybe !a || type of !== 'object'
, Iβm not sure it will be useful transformation. How do you check that variable
is object
?
For example, I just use isObject()
and IDE (or putout β-fix
) will write implementation for me (same with πPutout Editor, by the way, it will just declare it, and it will be used in transformation code)
Closed due to a long time of inactivity π Feel free to reopen when you have new ideas.
It seems you forgot another
typeof
type check to fix in this rule. This can be easily fixed in JS:and TS: