-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathRescriptCore.res
113 lines (94 loc) · 2.83 KB
/
RescriptCore.res
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
include Core__Global
module Array = Core__Array
module Console = Core__Console
module DataView = Core__DataView
module Date = Core__Date
module Dict = Core__Dict
module Error = Core__Error
module Float = Core__Float
module Int = Core__Int
module BigInt = Core__BigInt
module Math = Core__Math
module Null = Core__Null
module Nullable = Core__Nullable
module Object = Core__Object
module Ordering = Core__Ordering
module Promise = Core__Promise
module RegExp = Core__RegExp
module String = Core__String
module Char = Core__Char
module Symbol = Core__Symbol
module Type = Core__Type
module JSON = Core__JSON
module Iterator = Core__Iterator
module AsyncIterator = Core__AsyncIterator
module Map = Core__Map
module WeakMap = Core__WeakMap
module Set = Core__Set
module WeakSet = Core__WeakSet
module ArrayBuffer = Core__ArrayBuffer
module TypedArray = Core__TypedArray
module Float32Array = Core__Float32Array
module Float64Array = Core__Float64Array
module Int8Array = Core__Int8Array
module Int16Array = Core__Int16Array
module Int32Array = Core__Int32Array
module Uint8Array = Core__Uint8Array
module Uint16Array = Core__Uint16Array
module Uint32Array = Core__Uint32Array
module Uint8ClampedArray = Core__Uint8ClampedArray
module BigInt64Array = Core__BigInt64Array
module BigUint64Array = Core__BigUint64Array
module Intl = Core__Intl
@val external window: Dom.window = "window"
@val external document: Dom.document = "document"
@val external globalThis: {..} = "globalThis"
external null: Core__Nullable.t<'a> = "#null"
external undefined: Core__Nullable.t<'a> = "#undefined"
external typeof: 'a => Core__Type.t = "#typeof"
/**
`import(value)` dynamically import a value or function from a ReScript
module. The import call will return a `promise`, resolving to the dynamically loaded
value.
## Examples
`Core__Array.res` file:
```rescript
@send external indexOf: (array<'a>, 'a) => int = "indexOf"
let indexOfOpt = (arr, item) =>
switch arr->indexOf(item) {
| -1 => None
| index => Some(index)
}
```
In other file you can import the `indexOfOpt` value defined in `Core__Array.res`
```rescript
let main = async () => {
let indexOfOpt = await import(Core__Array.indexOfOpt)
let index = indexOfOpt([1, 2], 2)
Console.log(index)
}
```
Compiles to:
```javascript
async function main() {
var add = await import("./Core__Array.mjs").then(function(m) {
return m.indexOfOpt;
});
var index = indexOfOpt([1, 2], 2);
console.log(index);
}
```
*/
external import: 'a => promise<'a> = "#import"
type t<'a> = Js.t<'a>
module MapperRt = Js.MapperRt
module Internal = Js.Internal
module Re = Core__RegExp // needed for the %re sugar
module Exn = Js.Exn
module Option = Core__Option
module List = Core__List
module Result = Core__Result
type null<+'a> = Js.null<'a>
type undefined<+'a> = Js.undefined<'a>
type nullable<+'a> = Js.nullable<'a>
let panic = Core__Error.panic