When working with the TypeScript abstract syntax tree, how do I determine the result type of a TypeScript.Expression object?
I am using TSLint and attempting to find invocations of setTimeout that do not pass an object of type Function as the first parameter. For example, in the following code, I want to know that setTimeout was invoked and that the first parameter is a function.
// function that produces a function
var createFunction : () => (() => void) = () => {};
// result of createFunction() should be of type function
setTimeout(createFunction());
The AST lines up like this:
- setTimeout -> TypeScript.CallExpression
- createFunction() -> TypeScript.Expression
I have tried to use the LanguageService to determine the type of the Expression, but none of the following APIs give me what I need:
- languageServices.getQuickInfoAtPosition
- languageServices.getDefinitionAtPosition
- languageServices.getTypeDefinitionAtPosition
Any ideas?