Closed jackbsteinberg closed 5 years ago
You have a web example here with setTimeout()
. A JS spec example would be parseFloat()
.
For accessors, you can figure out if they were declared in one of the built-in TypeScript definitions via code such as
// In a binary expressionstatement
const identifierNode = node.getExpression().getFirstChild();
const symbol = identifierNode.getSymbol();
return symbol.getDeclarations()[0].getSourceFile().path
.includes('/node_modules/typescript');
What about the case when you're not using Window accessors in a binary expression statement? If I want to use a window value elsewhere (e.g. formatURL(location, ...)
) then I don't think this would work
Sure, in that case just get the identifierNode
from somewhere else, ignoring the first line of the code sample.
Window methods like
setTimeout()
are going to cause difficulty because they don't follow the same pattern as other method calls and won't get detected and modified.Additionally, Window isn't in the
globals-set.js
file to begin with, soisGlobal(Window)
would return false anyway.This is looking like it's going to have to be its own separate case to be handled.