typecheck for variable that may not be set