code: function checkSourceFileWorker(node) {
              var links = getNodeLinks(node);
              if (!(links.flags & 1 /* TypeChecked */)) {
                  // If skipLibCheck is enabled, skip type checking if file is a declaration file.
                  // If skipDefaultLibCheck is enabled, skip type checking if file contains a
                  // '/// <reference no-default-lib="true"/>' directive.
                  if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {
                      return;
                  }
                  // Grammar checking
                  checkGrammarSourceFile(node);
                  potentialThisCollisions.length = 0;
                  deferredNodes = [];
                  deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined;
                  ts.forEach(node.statements, checkSourceElement);
                  checkDeferredNodes();
                  if (ts.isExternalModule(node)) {
                      registerForUnusedIdentifiersCheck(node);
                  }
                  if (!node.isDeclarationFile) {
                      checkUnusedIdentifiers();
                  }
                  deferredNodes = undefined;
                  deferredUnusedIdentifierNodes = undefined;
                  if (ts.isExternalOrCommonJsModule(node)) {
                      checkExternalModuleExports(node);
                  }
                  if (potentialThisCollisions.length) {
                      ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);
                      potentialThisCollisions.length = 0;
                  }
                  links.flags |= 1 /* TypeChecked */;
              }
          }
docs: Fully type check a source file and collect the relevant diagnostics.