Skip to content

Commit eefdc91

Browse files
committed
more migrations
1 parent 42b1900 commit eefdc91

File tree

46 files changed

+878
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+878
-105
lines changed

packages/@rescript/runtime/Js.res

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,50 +156,105 @@ module Map = Js_map
156156
module WeakMap = Js_weakmap
157157

158158
/** JS object type */
159+
@deprecated(
160+
"This has been deprecated and will be removed in v13. Use the `{..}` type directly instead."
161+
)
159162
type t<'a> = {..} as 'a
160163

161164
/** JS global object reference */
162165
@val
166+
@deprecated({
167+
reason: "Use `globalThis` directly instead.",
168+
migrate: globalThis(),
169+
})
163170
external globalThis: t<'a> = "globalThis"
164171

172+
@deprecated({
173+
reason: "Use `Null.t` directly instead.",
174+
migrate: %replace.type(: Null.t),
175+
})
165176
@unboxed
166177
type null<+'a> = Js_null.t<'a> = Value('a) | @as(null) Null
167178

179+
@deprecated("This has been deprecated and will be removed in v13.")
168180
type undefined<+'a> = Js_undefined.t<'a>
169181

170182
@unboxed
183+
@deprecated({
184+
reason: "Use `Nullable.t` directly instead.",
185+
migrate: %replace.type(: Nullable.t),
186+
})
171187
type nullable<+'a> = Js_null_undefined.t<'a> = Value('a) | @as(null) Null | @as(undefined) Undefined
172188

189+
@deprecated({
190+
reason: "Use `Nullable.t` directly instead.",
191+
migrate: %replace.type(: Nullable.t),
192+
})
173193
type null_undefined<+'a> = nullable<'a>
174194

175195
external toOption: nullable<'a> => option<'a> = "%nullable_to_opt"
196+
@deprecated({
197+
reason: "Use `fromUndefined` instead.",
198+
migrate: fromUndefined(),
199+
})
176200
let undefinedToOption: undefined<'a> => option<'a> = Primitive_option.fromUndefined
201+
@deprecated({
202+
reason: "Use `Null.toOption` instead.",
203+
migrate: Null.toOption(),
204+
})
177205
external nullToOption: null<'a> => option<'a> = "%null_to_opt"
206+
@deprecated({
207+
reason: "Use `isNullable` directly instead.",
208+
migrate: isNullable(),
209+
})
178210
external isNullable: nullable<'a> => bool = "%is_nullable"
211+
@deprecated({
212+
reason: "Use `import` directly instead.",
213+
migrate: import(),
214+
})
179215
external import: 'a => promise<'a> = "%import"
180216

181217
/** The same as {!test} except that it is more permissive on the types of input */
218+
@deprecated({
219+
reason: "Use `testAny` directly instead.",
220+
migrate: testAny(),
221+
})
182222
external testAny: 'a => bool = "%is_nullable"
183223

184224
/**
185225
The promise type, defined here for interoperation across packages.
186226
*/
227+
@deprecated(
228+
"This is deprecated and will be removed in v13. Use the `promise` type directly instead."
229+
)
187230
type promise<+'a, +'e>
188231

189232
/**
190233
The same as empty in `Js.Null`. Compiles to `null`.
191234
*/
235+
@deprecated({
236+
reason: "Use `null` instead.",
237+
migrate: null(),
238+
})
192239
external null: null<'a> = "%null"
193240

194241
/**
195242
The same as empty `Js.Undefined`. Compiles to `undefined`.
196243
*/
244+
@deprecated({
245+
reason: "Use `undefined` instead.",
246+
migrate: undefined(),
247+
})
197248
external undefined: undefined<'a> = "%undefined"
198249

199250
/**
200251
`typeof x` will be compiled as `typeof x` in JS. Please consider functions in
201252
`Js.Types` for a type safe way of reflection.
202253
*/
254+
@deprecated({
255+
reason: "Use `typeof` instead.",
256+
migrate: typeof(),
257+
})
203258
external typeof: 'a => string = "%typeof"
204259

205260
/** Equivalent to console.log any value. */
@@ -245,8 +300,20 @@ external log4: ('a, 'b, 'c, 'd) => unit = "log"
245300
@variadic
246301
external logMany: array<'a> => unit = "log"
247302

303+
@deprecated({
304+
reason: "Use `eqNull` directly instead.",
305+
migrate: eqNull(),
306+
})
248307
external eqNull: ('a, null<'a>) => bool = "%equal_null"
308+
@deprecated({
309+
reason: "Use `eqUndefined` directly instead.",
310+
migrate: eqUndefined(),
311+
})
249312
external eqUndefined: ('a, undefined<'a>) => bool = "%equal_undefined"
313+
@deprecated({
314+
reason: "Use `eqNullable` directly instead.",
315+
migrate: eqNullable(),
316+
})
250317
external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"
251318

252319
/* ## Operators */
@@ -256,22 +323,38 @@ external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"
256323
It is marked as unsafe, since it is impossible
257324
to give a proper semantics for comparision which applies to any type
258325
*/
326+
@deprecated({
327+
reason: "Use `lt` instead.",
328+
migrate: lt(),
329+
})
259330
external unsafe_lt: ('a, 'a) => bool = "%unsafe_lt"
260331

261332
/**
262333
`unsafe_le(a, b)` will be compiled as `a <= b`.
263334
See also `Js.unsafe_lt`.
264335
*/
336+
@deprecated({
337+
reason: "Use `le` instead.",
338+
migrate: le(),
339+
})
265340
external unsafe_le: ('a, 'a) => bool = "%unsafe_le"
266341

267342
/**
268343
`unsafe_gt(a, b)` will be compiled as `a > b`.
269344
See also `Js.unsafe_lt`.
270345
*/
346+
@deprecated({
347+
reason: "Use `gt` instead.",
348+
migrate: gt(),
349+
})
271350
external unsafe_gt: ('a, 'a) => bool = "%unsafe_gt"
272351

273352
/**
274353
`unsafe_ge(a, b)` will be compiled as `a >= b`.
275354
See also `Js.unsafe_lt`.
276355
*/
356+
@deprecated({
357+
reason: "Use `ge` instead.",
358+
migrate: ge(),
359+
})
277360
external unsafe_ge: ('a, 'a) => bool = "%unsafe_ge"

packages/@rescript/runtime/Js_OO.res

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,52 +24,52 @@
2424

2525
@@config({flags: ["-unboxed-types"]})
2626

27-
@deprecated
27+
@deprecated("This has been deprecated and will be removed in v13.")
2828
external unsafe_to_method: 'a => 'a = "%unsafe_to_method"
2929

3030
module Callback = {
31-
@deprecated
31+
@deprecated("This has been deprecated and will be removed in v13.")
3232
type arity1<'a> = {@internal i1: 'a}
33-
@deprecated
33+
@deprecated("This has been deprecated and will be removed in v13.")
3434
type arity2<'a> = {@internal i2: 'a}
35-
@deprecated
35+
@deprecated("This has been deprecated and will be removed in v13.")
3636
type arity3<'a> = {@internal i3: 'a}
37-
@deprecated
37+
@deprecated("This has been deprecated and will be removed in v13.")
3838
type arity4<'a> = {@internal i4: 'a}
39-
@deprecated
39+
@deprecated("This has been deprecated and will be removed in v13.")
4040
type arity5<'a> = {@internal i5: 'a}
41-
@deprecated
41+
@deprecated("This has been deprecated and will be removed in v13.")
4242
type arity6<'a> = {@internal i6: 'a}
43-
@deprecated
43+
@deprecated("This has been deprecated and will be removed in v13.")
4444
type arity7<'a> = {@internal i7: 'a}
45-
@deprecated
45+
@deprecated("This has been deprecated and will be removed in v13.")
4646
type arity8<'a> = {@internal i8: 'a}
47-
@deprecated
47+
@deprecated("This has been deprecated and will be removed in v13.")
4848
type arity9<'a> = {@internal i9: 'a}
49-
@deprecated
49+
@deprecated("This has been deprecated and will be removed in v13.")
5050
type arity10<'a> = {@internal i10: 'a}
51-
@deprecated
51+
@deprecated("This has been deprecated and will be removed in v13.")
5252
type arity11<'a> = {@internal i11: 'a}
53-
@deprecated
53+
@deprecated("This has been deprecated and will be removed in v13.")
5454
type arity12<'a> = {@internal i12: 'a}
55-
@deprecated
55+
@deprecated("This has been deprecated and will be removed in v13.")
5656
type arity13<'a> = {@internal i13: 'a}
57-
@deprecated
57+
@deprecated("This has been deprecated and will be removed in v13.")
5858
type arity14<'a> = {@internal i14: 'a}
59-
@deprecated
59+
@deprecated("This has been deprecated and will be removed in v13.")
6060
type arity15<'a> = {@internal i15: 'a}
61-
@deprecated
61+
@deprecated("This has been deprecated and will be removed in v13.")
6262
type arity16<'a> = {@internal i16: 'a}
63-
@deprecated
63+
@deprecated("This has been deprecated and will be removed in v13.")
6464
type arity17<'a> = {@internal i17: 'a}
65-
@deprecated
65+
@deprecated("This has been deprecated and will be removed in v13.")
6666
type arity18<'a> = {@internal i18: 'a}
67-
@deprecated
67+
@deprecated("This has been deprecated and will be removed in v13.")
6868
type arity19<'a> = {@internal i19: 'a}
69-
@deprecated
69+
@deprecated("This has been deprecated and will be removed in v13.")
7070
type arity20<'a> = {@internal i20: 'a}
71-
@deprecated
71+
@deprecated("This has been deprecated and will be removed in v13.")
7272
type arity21<'a> = {@internal i21: 'a}
73-
@deprecated
73+
@deprecated("This has been deprecated and will be removed in v13.")
7474
type arity22<'a> = {@internal i22: 'a}
7575
}

packages/@rescript/runtime/Stdlib_Array.res

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@ external unsafe_get: (array<'a>, int) => 'a = "%array_unsafe_get"
1313
@val
1414
external fromArrayLikeWithMap: (arrayLike<'a>, 'a => 'b) => array<'b> = "Array.from"
1515

16-
@deprecated("Use `fill` instead") @send external fillAll: (array<'a>, 'a) => unit = "fill"
16+
@deprecated({
17+
reason: "Use `fill` instead",
18+
migrate: Array.fill(),
19+
})
20+
@send
21+
external fillAll: (array<'a>, 'a) => unit = "fill"
1722

1823
@val external fromString: string => array<string> = "Array.from"
1924

20-
@deprecated("Use `fill` instead") @send
25+
@deprecated({
26+
reason: "Use `fill` instead",
27+
migrate: Array.fill(
28+
%insert.unlabelledArgument(0),
29+
%insert.unlabelledArgument(1),
30+
~start=%insert.labelledArgument("start"),
31+
),
32+
})
33+
@send
2134
external fillToEnd: (array<'a>, 'a, ~start: int) => unit = "fill"
2235

2336
@send external fill: (array<'a>, 'a, ~start: int=?, ~end: int=?) => unit = "fill"
@@ -86,10 +99,15 @@ let compare = (a, b, cmp) => {
8699
: compareFromIndex(a, b, 0, cmp, lenA)
87100
}
88101

89-
@deprecated("Use `copyWithin` instead") @send
102+
@deprecated("Use `copyWithin` instead")
103+
@send
90104
external copyAllWithin: (array<'a>, ~target: int) => array<'a> = "copyWithin"
91105

92-
@deprecated("Use `copyWithin` instead") @send
106+
@deprecated({
107+
reason: "Use `copyWithin` instead",
108+
migrate: Array.copyWithin(),
109+
})
110+
@send
93111
external copyWithinToEnd: (array<'a>, ~target: int, ~start: int) => array<'a> = "copyWithin"
94112

95113
@send
@@ -134,17 +152,29 @@ let indexOfOpt = (arr, item) =>
134152
| -1 => None
135153
| index => Some(index)
136154
}
137-
@deprecated("Use `indexOf` instead") @send
155+
@deprecated({
156+
reason: "Use `indexOf` instead",
157+
migrate: Array.indexOf(~from=%insert.unlabelledArgument(2)),
158+
})
159+
@send
138160
external indexOfFrom: (array<'a>, 'a, int) => int = "indexOf"
139161

140162
@send external join: (array<string>, string) => string = "join"
141163

142-
@deprecated("Use `join` instead") @send
164+
@deprecated({
165+
reason: "Use `join` instead",
166+
migrate: Array.join(),
167+
})
168+
@send
143169
external joinWith: (array<string>, string) => string = "join"
144170

145171
@send external joinUnsafe: (array<'a>, string) => string = "join"
146172

147-
@deprecated("Use `joinUnsafe` instead") @send
173+
@deprecated({
174+
reason: "Use `joinUnsafe` instead",
175+
migrate: Array.joinUnsafe(),
176+
})
177+
@send
148178
external joinWithUnsafe: (array<'a>, string) => string = "join"
149179

150180
@send external lastIndexOf: (array<'a>, 'a, ~from: int=?) => int = "lastIndexOf"
@@ -153,11 +183,19 @@ let lastIndexOfOpt = (arr, item) =>
153183
| -1 => None
154184
| index => Some(index)
155185
}
156-
@deprecated("Use `lastIndexOf` instead") @send
186+
@deprecated({
187+
reason: "Use `lastIndexOf` instead",
188+
migrate: Array.lastIndexOf(~from=%insert.unlabelledArgument(2)),
189+
})
190+
@send
157191
external lastIndexOfFrom: (array<'a>, 'a, int) => int = "lastIndexOf"
158192

159193
@send external slice: (array<'a>, ~start: int=?, ~end: int=?) => array<'a> = "slice"
160-
@deprecated("Use `slice` instead") @send
194+
@deprecated({
195+
reason: "Use `slice` instead",
196+
migrate: Array.slice(),
197+
})
198+
@send
161199
external sliceToEnd: (array<'a>, ~start: int) => array<'a> = "slice"
162200

163201
@send external copy: array<'a> => array<'a> = "slice"

0 commit comments

Comments
 (0)