https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#using-the-type-checker describes how to use the type checker in the compiler API but the example code does not work with typescript 3.4.