core-typed

emccue 2022-03-31T03:27:23.504889Z

I'm a little confused on how any works

2022-03-31T22:42:28.567129Z

s/Any cannot be passed as a (t/Seqable t/Any). But (t/Seqable t/Any) can be passed as t/Any .

2022-03-31T22:44:43.700479Z

With the current annotation for y, you could have (def y :kw) which is not a (t/Seqable t/Any)

2022-03-31T22:52:51.425049Z

if it helps, t/Any is more like Object in Java, and is nothing like any in TypeScript

2022-03-31T22:53:33.528389Z

it's (only) the top of the type hierarchy (TS's any is also the bottom).

emccue 2022-03-31T23:41:46.882579Z

is there a bottom type? (never or such)

2022-04-01T00:44:52.191089Z

t/Nothing aka (t/U)

2022-04-01T00:46:48.473459Z

if you need an escape hatch like any, there are a few options. 1. (t/ann ^:no-check foo ...) ignores the definition of vars 2. clojure.core.typed.unsafe/ignore-with-unchecked-cast casts a form to any type. There'll probably be more ways in the future.

2022-04-01T00:47:45.605999Z

You can also wrap forms in (t/tc-ignore ..) to completely skip them. I think the best balance is ^:no-check + t/tc-ignore atm.

2022-04-01T00:48:35.553239Z

But one of the things that has made typed clojure still interesting to me after all these years was avoiding an any type, so this is the state of things 🙂

2022-04-01T00:51:05.988709Z

the discoverability is very low on this stuff so feel free to keep asking

emccue 2022-04-01T03:14:08.436069Z

yeah - so long as this slack keeps history you can maybe use it for copy pasting into a wiki

emccue 2022-03-31T03:27:38.853109Z

(t/ann x t/Any)
(def x ",")

(t/ann y t/Any)
(def y ["a"])

(string/join x y)
(comment
  (t/check-ns-clj))

emccue 2022-03-31T03:28:40.285189Z

This code fails with

Type Error (file:/Users/emccue/Development/tyyyyyped/src/tyt.clj:12:1) 
Function string/join could not be applied to arguments:


Domains:
	t/Any (t/Seqable t/Any)

Arguments:
	t/Any t/Any

Ranges:
	t/Str




in:
(string/join x y)



Execution error (ExceptionInfo) at clojure.core.typed.errors/print-errors! (errors.cljc:273).
Type Checker: Found 1 error
on type checking - which means that t/Any doesn't satisfy (t/Seqable t/Any), which confuses me some