Skip to content

Commit 874d3bd

Browse files
WIP: Deprecate Js namespace
1 parent 01ee097 commit 874d3bd

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

runtime/Js.res

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,65 +173,91 @@ module Map = Js_map
173173
module WeakMap = Js_weakmap
174174

175175
/** JS object type */
176+
@deprecated("Use `{..}` instead")
176177
type t<'a> = {..} as 'a
177178

178179
/** JS global object reference */
180+
@deprecated("Use Stdlib.globalThis instead")
179181
@val
180182
external globalThis: t<'a> = "globalThis"
181183

182-
@unboxed
184+
@deprecated("Use Stdlib.null instead") @unboxed
183185
type null<+'a> = Js_null.t<'a> = Value('a) | @as(null) Null
184186

187+
@deprecated("Use Stdlib.undefined instead")
185188
type undefined<+'a> = Js_undefined.t<'a>
186189

187-
@unboxed
190+
@deprecated("Use Stdlib.nullable instead") @unboxed
188191
type nullable<+'a> = Js_null_undefined.t<'a> = Value('a) | @as(null) Null | @as(undefined) Undefined
189192

193+
@deprecated("Use Stdlib.nullable instead")
190194
type null_undefined<+'a> = nullable<'a>
191195

196+
@deprecated("Use Stdlib.Nullable.toOption instead")
192197
external toOption: nullable<'a> => option<'a> = "%nullable_to_opt"
198+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_option.fromUndefined")
193199
external undefinedToOption: undefined<'a> => option<'a> = "%undefined_to_opt"
200+
@deprecated("Use Stdlib.Null.toOption instead")
194201
external nullToOption: null<'a> => option<'a> = "%null_to_opt"
202+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.isNullable")
195203
external isNullable: nullable<'a> => bool = "%is_nullable"
204+
@deprecated("Use Stdlib.import instead")
196205
external import: 'a => promise<'a> = "%import"
197206

198207
/** The same as {!test} except that it is more permissive on the types of input */
208+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.testAny")
199209
external testAny: 'a => bool = "%is_nullable"
200210

201211
/**
202212
The promise type, defined here for interoperation across packages.
203213
*/
214+
@deprecated("Use Stdlib.Promise.t instead")
204215
type promise<+'a, +'e>
205216

206217
/**
207218
The same as empty in `Js.Null`. Compiles to `null`.
208219
*/
220+
@deprecated("Use Stdlib.null instead")
209221
external null: null<'a> = "%null"
210222

211223
/**
212224
The same as empty `Js.Undefined`. Compiles to `undefined`.
213225
*/
226+
@deprecated("Use Stdlib.undefined instead")
214227
external undefined: undefined<'a> = "%undefined"
215228

216229
/**
217230
`typeof x` will be compiled as `typeof x` in JS. Please consider functions in
218231
`Js.Types` for a type safe way of reflection.
219232
*/
233+
@deprecated("Use Stdlib.typeof instead")
220234
external typeof: 'a => string = "%typeof"
221235

222-
@val @scope("console") /** Equivalent to console.log any value. */
236+
/** Equivalent to console.log any value. */
237+
@deprecated("Use Stdlib.Console.log instead")
238+
@val
239+
@scope("console")
223240
external log: 'a => unit = "log"
224241

225-
@val @scope("console") external log2: ('a, 'b) => unit = "log"
226-
@val @scope("console") external log3: ('a, 'b, 'c) => unit = "log"
227-
228-
@val @scope("console") external log4: ('a, 'b, 'c, 'd) => unit = "log"
242+
@deprecated("Use Stdlib.Console.log2 instead") @val @scope("console")
243+
external log2: ('a, 'b) => unit = "log"
244+
@deprecated("Use Stdlib.Console.log3 instead") @val @scope("console")
245+
external log3: ('a, 'b, 'c) => unit = "log"
246+
@deprecated("Use Stdlib.Console.log4 instead") @val @scope("console")
247+
external log4: ('a, 'b, 'c, 'd) => unit = "log"
229248

230-
@val @scope("console") @variadic /** A convenience function to console.log more than 4 arguments */
249+
/** A convenience function to console.log more than 4 arguments */
250+
@deprecated("Use Stdlib.Console.logMany instead")
251+
@val
252+
@scope("console")
253+
@variadic
231254
external logMany: array<'a> => unit = "log"
232255

256+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.eqNull")
233257
external eqNull: ('a, null<'a>) => bool = "%equal_null"
258+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.eqUndefined")
234259
external eqUndefined: ('a, undefined<'a>) => bool = "%equal_undefined"
260+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.eqNullable")
235261
external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"
236262

237263
/* ## Operators */
@@ -241,22 +267,26 @@ external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"
241267
It is marked as unsafe, since it is impossible
242268
to give a proper semantics for comparision which applies to any type
243269
*/
270+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.lt")
244271
external unsafe_lt: ('a, 'a) => bool = "%unsafe_lt"
245272

246273
/**
247274
`unsafe_le(a, b)` will be compiled as `a <= b`.
248275
See also `Js.unsafe_lt`.
249276
*/
277+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.le")
250278
external unsafe_le: ('a, 'a) => bool = "%unsafe_le"
251279

252280
/**
253281
`unsafe_gt(a, b)` will be compiled as `a > b`.
254282
See also `Js.unsafe_lt`.
255283
*/
284+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.gt")
256285
external unsafe_gt: ('a, 'a) => bool = "%unsafe_gt"
257286

258287
/**
259288
`unsafe_ge(a, b)` will be compiled as `a >= b`.
260289
See also `Js.unsafe_lt`.
261290
*/
291+
@deprecated("FIXME: No equivalent in Stdlib, just Primitive_js_extern.ge")
262292
external unsafe_ge: ('a, 'a) => bool = "%unsafe_ge"

0 commit comments

Comments
 (0)