This repository has been archived by the owner on Feb 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO
93 lines (90 loc) · 3.18 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
* Next
[ ] add JS primitives
[x] cljs.core.typed/JSUndefined
* 'undefined' in TypeScript
* idea 1: nil expands to (U nil Undefined) internally, but always elide Undefined
when pretty-printing a union that includes both nil and Undefined.
* This to avoids:
Expected: nil, Given: nil
since
Expected: (U Undefined nil), Given: nil
* Problem: lots of special casing for Nil? in the type checker
* support nil?/undefined?/some? predicates
* recognize undefined as a false value
* (= x nil) ;=> (is x (U nil Undefined))
* idea 2: New type JSNull
(U JSNull JSUndefined) <: nil
nil <!: JSNull
nil <!: JSUndefined
* JSNull reserved mostly for interop
* JSNull pprints to nil
(inc nil)
; Error:
; Expected: Number
; Given: nil
* nil :- JSNull
(ann f [JSNull -> Any])
(f nil)
* structural equality on `nil` should be enhanced
(let [x :- JSNull nil
y :- nil nil
z :- JSUndefined ...]
(= x y z))
; true ; tt | ff
[x] support undefined? predicates
* unit tests for 'if'
[*] cljs.core.typed/JSNumber
* 'number' in TypeScript
* (ann number? (Pred JSNumber))
[*] cljs.core.typed/JSBoolean
* 'boolean' in TypeScript
[*] cljs.core.typed/JSString
* 'string' in TypeScript
[*] cljs.core.typed/JSSymbol
* 'symbol' in TypeScript
[*] add cljs.core.typed/JSObject
* any non-primitive type
* 'object' in TypeScript
* https://blog.mariusschulz.com/2017/02/24/typescript-2-2-the-object-type
* 'Object' in Google Closure (or 'Object<?,?>' maybe?)
* https://github.com/google/closure-compiler/wiki/A-word-about-the-type-Object
[*] rename int => cljs.core.typed/JSInteger
* for `integer?`
[ ] create JSObj type
* analogous to HMap
* Use undefined to signal optional
* (JSObj {:a (t/U Node t/JSUndefined)
:b})
[ ] implement ann-js
[ ] implement ann-jsclass
[ ] implement ann-jsinterface
[ ] implement ann-jsalias
[ ] support js/undefined top-level builtin classes
* eg. js/String, js/Symbol, js/Function
* Note. js/Object is 'Object' in TypeScript
* Note. js/Function is 'Function' in Google Closure
* Note. js/Array is 'Array' in Google Closure
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
* https://funcool.github.io/clojurescript-unraveled/
[ ] add common Regex annotation for #""
[ ] remove cljs.core.typed/IPersistentMap etc.
[ ] remove ArrayCLJS
* replace with js/Array
[ ] remove FunctionCLJS
* replace with js/Function
[ ] fix cct.subtype/resolve-JS-reference function
[ ] remove letfn> etc.
* replace with non-> versions
* rename primitives to lower case (or namespaced in `js`?)
* JSboolean, JSsymbol, JSstring, JSnull, JSundefined
* js/boolean, js/symbol, js/string, js/null, js/undefined
* handle special Closure types
* possibly prefix with `js`?
* js/IObject, js/IArrayLike, js/IThenable
# Later
* add heterogeneous object type
* optional entries
* delete Array stuff for CLJ/CLJS
* revise default js-nominal mappings
* pprint JSUndefined and JSNull to `nil` when appropriate
* `boolean?` tests for primitive boolean