typed.clojure in macros namespace(requiring-resolve 'fully-qualified/sym)
fully-qualified is not an alias in any namespace(requiring-resolve 'fully-qualified/sym) evaluates
to a var, and a type annotation is found for fully-qualified/sym, then
returns type (t/Var (t/TypeOf fully-qualified/sym))requiring-resolve annotation
clojure.core/record?__meta and __extmap on records:no-eval option on check-form family of functions
:check-config {:check-form-eval :{before/never}}:check-config map accepted by check-{ns,form}
require all checked namespaces before checking.typed.clj.analyzer/*parse-deftype-with-existing-class*
(map :a ...) checks like (map #(:a %) ...)
t/Instance and t/Satisfies
t/Instance provides classes with invariant type parameters with a common super type
(t/Instance Comparable) is a supertype of (Comparable Any)t/Satisfies, but for protocolsinstance? and satisfies?
(t/Instance Comparable) if (instance? Comparable ..), not (Comparable Any)(I Int (Nilable Int)) => Int, not (Nilable Int)override-class at runtimejava.util.SequencedCollection and extend in java.util.Listt/Var2, change `clojure.lang.Var to take only 1 type parameter
t/AnyVar for (t/Var2 t/Nothing t/Any)t/Var1
t/Vart/Ref2, change `clojure.lang.Ref to take only 1 type parameter
t/AnyRef for (t/Ref2 t/Nothing t/Any)t/Ref1
t/Reft/Agent2, change `clojure.lang.Agent to take only 1 type parameter
t/AnyAgent for (t/Agent2 t/Nothing t/Any)t/Agent1
t/Agentt/Atom2, change `clojure.lang.Atom to take only 1 type parameter
t/AnyAtom for (t/Atom2 t/Nothing t/Any)t/Atom1
t/Atomt/Volatile2, change `clojure.lang.Volatile to take only 1 type parameter
t/AnyVolatile for (t/Volatile2 t/Nothing t/Any)t/AnySeqable and t/AnyNilableNonEmptySeqresolve to qualify first argument of t/ann-protocol
defprotocolt/Type is the kind of all types(t/Type :< upper :> lower)(t/All [b :..] ['[b :.. b] :.. b -> t/Any])(t/* t/Type)(t/Match nil nil :-> nil) ;=> nil
(t/Match t/Int
nil :-> nil
t/Int :-> t/Bool) ;=> t/Bool
(t/Match (t/Seqable t/Num)
[[E :< t/Int]] (t/Seqable E) :-> '[':first E]
[E] (t/Seqable E) :-> '[':second E])
;=> '[':second t/Num]"
t/SeqOn
seq for given argument type(t/SeqOn nil) => nil(t/SeqOn '[1 2]) => (t/HSeq :types ['1 '2])(t/SeqOn (t/Seqable t/Any)) => (t/NilableNonEmptyASeq t/Any)clojure.core/seq to use t/SeqOnSeq, which represents the result of calling clojure.core/seq
clojure.core/seq annotationcc/butlast returns a nilable non-empty seqoverride-class are more intuitive
clojure.core/bases instead of clojure.core/supers(Seqable A) and (Seqable B) transitively
cc/keyword can accept nil as first argcc/derive returns a Hierarchy:variance inference on t/TFn parameters
(TFn [x] x) == (TFn [[x :variance :covariant]] x)cc/fn expressions now additionally infer as t/Fnt/TFn variable bounds now only has variables to the left of it in scope, rather
than all variables being bound simultaneously in all bounds
(TFn [y [x :< y]] t/Any)(TFn [[x :< y] y] t/Any)t/Volatile{2}, support cc/volatile! and cc/vreset!{r}subseq annotationst/Get optional 3rd argument (default type)group-by to return non-empty vector groupsclojure.lang.Seqable and cljs.core/ISeqable to take a Seq as type parameter
(clojure.lang.Seqable x) => (t/Seqable x)t/Merge of type variablesassoc support less unsound
clojure.core/reductions annotation
reduced valuesclojure.core/reduce annotation
reducedclojure.core/keep transducer arityclojure.core/keep never returns nil, update annotation appropriatelyfilter, remove, {take,drop}-while, partition-all, distinct,
interpose, {map,keep}-indexed,keep accepts Seqable, not just Colldrop-lastkeyword 1-arity to accept a variteration, partitionv, parse-{uuid,boolean,double,long}, update-{keys,vals}, abs, NaN?, infinite?, *repl*, replace,
partition-by, cat, dedupe, random-sample, eduction, tagged-literal{?}, reader-conditional{?}, unreduced, halt-when, ensure-reduced, completing,
transduce, sorted-map-by, rational?, float?, {r}subseqcompkeys and valspeek in most general case (nilable return)(reduce (fn [a b] (+ a b)) [1])(comp (fn [y] y) (fn [x] x))t/Infer, like t/Any but downcasted when checked against a more specific type(fn [x] x) prints as [Nothing :-> Nothing](map (fn [x] x)) prints as (Transducer Nothing Nothing)t/Inferclojure.core.typed alias in current namespace to shorten types (rather than just typed.clojure)(into [] (map identity) [1])fn against a union typet/*, t/+, t/alt, t/?, t/cat
IFn. e.g.,
[(t/cat a b) :-> t/Any] => [a b :-> t/Any][(t/cat a b) :* :-> t/Any] => [(t/HSequential [a b] :repeat true) <* :-> t/Any][(t/cat a b) :.. c :-> t/Any] => [(t/HSequential [a b] :repeat true) <... c :-> t/Any][(t/* a) :-> t/Any] => [a :* :-> t/Any][(t/? a) :-> t/Any] => (IFn [:-> t/Any] [a :-> t/Any])[(t/+ a) :-> t/Any] => [a :+ :-> t/Any] => [a a :* :-> t/Any][(t/alt (t/cat a) (t/cat a b)) :-> t/Any] => (t/IFn [a :-> t/Any] [a b :-> t/Any])clojure.core/update(typed.clojure/fn ...) as symbolic closure if unannotateddefmulticlojure.core.async/pipeclojure.core.typed/{for,doseq}
clojure.core/{for,doseq}clojure.core.typed.deprecated-wrapper-macros=true to add them backt/ann, t/ann-protocol etc., are now removed from the
global type environment if the (Clojure JVM) namespace in which those macros occur is removed or reloaded.
t/ann simply by correcting it, then refreshing the namespace via tools.namespace.
the underlying annotation for the misspelled version is removed as if it were a var in the old namespace.:collect-only feature
typed.spec.clojure.core/atom-spec:forms documentation for core aliases(merge) as nilt/Merge
clojure.core/merge but at the type level(t/Merge '{:a t/Int :b t/Bool} '{:a t/Bool :c t/Str}) => '{:a t/Bool :b t/Bool :c t/Str}^:typed.clojure/ignore or ^{:typed.clojure {:ignore true}} meta
(ns ^:typed.clojure/ignore foo)typed.clojure/check-dir-clj{s} for type checking directories of codetyped.clojure.main for command line usage^::t/dbg output[:maybe] case in Malli schema to static type translation[:and s1 s2 s3 ...] to s1 in type translation to avoid tricky subtyping cases^:fake-quote 'TYPE <=> TYPE^{::t/- TYPE} EXP <=> (t/ann-form EXP TYPE)^{::t/inst [...]} EXP <=> (t/inst EXP ...)^{::t/unsafe-cast TYPE} EXP checks EXP with no expected type and unsafely infers type TYPE^::t/ignore EXP <=> (t/tc-ignore EXP)^::t/dbg EXP prints type info on EXPtyped.clojure/doc-clj{s} for documentation snippets and type lookupclojure.core.typed/envs[Foo Bar :+ :-> Baz] <=> [Foo Bar Bar :* :-> Baz][Foo Bar :? :-> Baz] <=> (IFn [Foo :-> Baz] [Foo Bar :-> Baz]){min,max}-keydisjclojure.test/run-all-testsmerge is a map, rest can be nilable and still returns a map:.. keyword syntax for dotted rest argument (along with ... and :...)t/All parsing: allow combining :.. with keyword args: (t/All [a :.. :named [b])(t/Assoc c ... c) type syntax to (t/Assoc c :.. c):{?,*,+}:* function types
(-> (fn ([] 0)
([a] (+ a))
([a b & more] (apply + a b more)))
(ann-form [t/Int :* :-> t/Int]))
(ann-form (fn [& rst] (first rst)) [t/Int :+ :-> t/Int])set!clojure.core.typed/envs
sort-by, method-sig, partitionclojure.core/fn
(t/fn [a :- t/Int]) <=> (cc/fn [^{:typed.clojure/- t/Int} a])(t/fn [] :- t/Bool) <=> (cc/fn ^{:typed.clojure/- t/Bool} [])(t/ann-form (t/fn [a] a) (t/All [x] [x :-> x])) <=> (cc/fn ^{:typed.clojure/- (t/All [x] [x :-> x])} _id [a] a)(fn [p :- [[t/Int :-> t/Int] :-> t/Int]] (p #(inc %)))typed.clojure/Associative now takes 2 type arguments (before, 3)
cljs.core/IAssociative, clojure.lang.Associativecc/reduce-kv annotationseqable?, indexed?, findt/MapEntry to t/AMapEntry for fn outputs, change t/MapEntry for fn inputstyped.clojure/cnstyped.clojure/check-ns-cljs from macro to functionclojure.core and cljs.core type rulesminimal-clj example project to test typed.clj.checker in isolation without cljs depsclojure.core/defprotocol rule for clj{s}cljs.core/implements? rule for cljs(defn sym-or-kw? [a] (or (symbol? a) (keyword? a))):flow filters
:filters around 2015.typed.clojure.jvm for jvm annotations
override-class -- see typed.ann.clojure.jvm for base environment usingclojure.core/reify in Clojure checkerclojure.core/satisfies? in Clojure checker:extend-via-metadata (and other kw options) in defprotocol wrappertyped.clojure/check-nstyped.clojure/check-ns{,-clj,cljs} no longer require the namespaces being checked to depend on a Typed Clojure namespacetyped.malli.schema-to-type/register-malli->type-extensionclojure.java.io annotations{pos,neg,nat}-int? annotationstyped.clj.malli submodule to typed.mallit/def and t/defn never infer their types, and use t/ann to register global annotation
typed.clojure namespacelib.spec.alpha lib for spec.alpha annotations
s/def and s/fdeftyped.cljs.analyzertyped.clojure namespace for cross-platform useclojure.core.typed.special-vars=true to restore:refering these vars is not cross-platform. type resolution can
work without these varsclojure.core.typed.intern-defaliases=true to restoreclojure.core/seqable?, so now we can annotate as (t/Pred (t/Seqable t/Any))clojure.core/boolean? annotationclojure.core/inc is appears in error messages instead of clojure.lang.RT/inctyped.clj.malli projectclojure.core/for typing rule with destructuringclojure.core/let typing ruletyped.clj.generators namespace to typed.clj.checkerCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |