git clone ''

(ql:quickload :clojure.core.typed)


Optional typing in Clojure, as a library.

Split into smaller repositories

This repository has been split into smaller repositories and will no longer be updated. See for instructions on upgrading.

Releases and Dependency Information

Latest stable release is 0.6.0.

Leiningen dependency information:

[org.clojure/core.typed "0.6.0"]

; for very recent releases
:repositories {"sonatype-oss-public" ""}

; for slim jars, follow version string with: :classifier "slim"

Maven dependency information:

  <!-- slim jar -->
  <!-- <classifier>slim</classifier> -->

The default jars contain AOT files for faster loading. If jar size is a concern, consider using the slim jar in production.


core.typed supports Clojure 1.9.0 and JDK 1.7+.

Getting started

Tldr; here is a complete project using core.typed.

With the core.typed JAR in your classpath, run the following code to enable automatic type checking. This is how to start with Leiningen.

:injections [(require 'clojure.core.typed)

Next add the following ns metadata to the file you are working with.

(ns test.core
  {:lang :core.typed})

Save the file and run (require 'test.core :reload). This should type check the file automatically.

It's useful to also import clojure.core.typed to annotate expressions.

(ns test.core
  {:lang :core.typed}
  (:require [clojure.core.typed :as t]))

(t/ann f [t/Any :-> t/Int])
(defn f [x]
  (t/cast t/Int x))

Expressions evaluated via eval will also be type checked if the following is true at runtime: (= :core.typed (:lang (meta *ns*))).

Runtime Spec and type inference

core.typed can observe your tests running and generate appropriate annotations for your functions.

First, call (clojure.core.typed/prepare-infer-ns) in the namespace you wish to infer.

Then, run the relevant tests, ensuring you don't accidentally re-load the instrumented namespace.

Finally, call (clojure.core.typed/runtime-infer) to insert core.typed annotations in your file, or (clojure.core.typed/spec-infer) for clojure.spec annotations.

[Talk] Clojure Conj 2012


Mailing List and IRC

Use the core.typed mailing list for core.typed discussion, or try #typed-clojure on Freenode (the main developer is ambrosebs).


See wiki.

API Reference

Ambrose's blog

Leiningen Plugin


Vim Plugin


Emacs Mode



(clojure.core.typed/ann v t) gives var v the static type t.

(clojure.core.typed/ann-form f t) ensures form f is of the static type t.

(clojure.core.typed/check-ns) type checks the current namespace.

(clojure.core.typed/cf t) type checks the form t.


core.async Rock-paper-scissors

ClojureScript Checker

The ClojureScript checker has not followed the last year of upstream changes, so it does not work. If you would like to help update the checker, please post on the mailing list.

Developer Information


Thanks to the following people for contributing to core.typed:


Development is sponsored (via crowdfunding) by

Brick Alloy
Snowplow Analytics
ThorTech Solutions
Shannon Severance
Cursive Clojure


YourKit is kindly supporting core.typed and other open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products:


Copyright © Ambrose Bonnaire-Sergeant, Rich Hickey & contributors.

Licensed under the EPL (see the file epl-v10.html).