     [expression] = _terms ast
     compilationFn = (topLevelExpressionInModule importsFor moduleDependencies moduleName)
     {js} = compileCtxAstToJs compilationFn, ctx, expression
+    errors = checkTypes ctx
     (finalizeTypes ctx, expression)
     js: library + immutable + (listOfLines map lookupJs, (setToArray runtimeDependencies moduleName)) + '\n;' + js
     ast: ast
-    errors: checkTypes ctx
+    errors: errors
     malformed: ctx.isMalformed
 
 importsFor = (moduleSet) ->

  visitExpressions ast, (expression) ->
    if expression.label is 'name' and expression.scope and (type = (ctx.finalType expression.symbol, expression.scope))
      expression.tea = type
    else if expression.tea
      expression.tea = substitute ctx.substitution, expression.tea
    return
  for scope in ctx.savedScopes when scope?
    for name, def of values scope.definitions when def.type

  style = if color then " style=\"color: #{color}\"" else ''
  "<span#{style}>#{string}</span>"

themize = (label, string) ->
  colorize theme[label], string

# TODO: figure out comments
# typeComments = (ast) ->
#   macro '#', ast, (node) ->
