checker.ts and at this moment it is 23k+ lines of TypeScript (largest part of the compiler).
checker is initialized by
program. The following is a sampling of the call stack (we showed the same one when looking at
program.getTypeChecker ->ts.createTypeChecker (in checker)->initializeTypeChecker (in checker) ->for each SourceFile `ts.bindSourceFile` (in binder)// followed byfor each SourceFile `ts.mergeSymbolTable` (in checker)
True type checking happens once a call is made to
getDiagnostics. This function is called e.g. once a request is made to
Program.emit, in which case the checker returns an
EmitResolver (program calls the checkers
getEmitResolver function) which is just a set of functions local to
createTypeChecker. We will mention this again when we look at the emitter.
Here is the call stack right down to
checkSourceFile (a function local to
program.emit ->emitWorker (program local) ->createTypeChecker.getEmitResolver ->// First call the following functions local to createTypeCheckercall getDiagnostics ->getDiagnosticsWorker ->checkSourceFile// thenreturn resolver(already initialized in createTypeChecker using a call to local createResolver())