Skip to content

WIP: Deprecate Js namespace #7510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions runtime/Js.res
Original file line number Diff line number Diff line change
Expand Up @@ -173,65 +173,91 @@ module Map = Js_map
module WeakMap = Js_weakmap

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

/** JS global object reference */
@deprecated("Use `globalThis` instead")
@val
external globalThis: t<'a> = "globalThis"

@unboxed
@deprecated("Use `null` instead") @unboxed
type null<+'a> = Js_null.t<'a> = Value('a) | @as(null) Null

@deprecated("Use `undefined` instead")
type undefined<+'a> = Js_undefined.t<'a>

@unboxed
@deprecated("Use `nullable` instead") @unboxed
type nullable<+'a> = Js_null_undefined.t<'a> = Value('a) | @as(null) Null | @as(undefined) Undefined

@deprecated("Use `nullable` instead")
type null_undefined<+'a> = nullable<'a>

@deprecated("Use `Nullable.toOption` instead")
external toOption: nullable<'a> => option<'a> = "%nullable_to_opt"
@deprecated("Do not use. This will be removed in v13")
external undefinedToOption: undefined<'a> => option<'a> = "%undefined_to_opt"
@deprecated("Use `Null.toOption` instead")
external nullToOption: null<'a> => option<'a> = "%null_to_opt"
@deprecated("Use `Null.isNullable` instead")
external isNullable: nullable<'a> => bool = "%is_nullable"
@deprecated("Use `import` instead")
external import: 'a => promise<'a> = "%import"

/** The same as {!test} except that it is more permissive on the types of input */
@deprecated("Do not use. This will be removed in v13")
external testAny: 'a => bool = "%is_nullable"

/**
The promise type, defined here for interoperation across packages.
*/
@deprecated("Use `Promise.t` instead")
type promise<+'a, +'e>

/**
The same as empty in `Js.Null`. Compiles to `null`.
*/
@deprecated("Use `null` instead")
external null: null<'a> = "%null"

/**
The same as empty `Js.Undefined`. Compiles to `undefined`.
*/
@deprecated("Use `undefined` instead")
external undefined: undefined<'a> = "%undefined"

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

@val @scope("console") /** Equivalent to console.log any value. */
/** Equivalent to console.log any value. */
@deprecated("Use `Console.log` instead")
@val
@scope("console")
external log: 'a => unit = "log"

@val @scope("console") external log2: ('a, 'b) => unit = "log"
@val @scope("console") external log3: ('a, 'b, 'c) => unit = "log"

@val @scope("console") external log4: ('a, 'b, 'c, 'd) => unit = "log"
@deprecated("Use `Console.log2` instead") @val @scope("console")
external log2: ('a, 'b) => unit = "log"
@deprecated("Use `Console.log3` instead") @val @scope("console")
external log3: ('a, 'b, 'c) => unit = "log"
@deprecated("Use `Console.log4` instead") @val @scope("console")
external log4: ('a, 'b, 'c, 'd) => unit = "log"

@val @scope("console") @variadic /** A convenience function to console.log more than 4 arguments */
/** A convenience function to console.log more than 4 arguments */
@deprecated("Use `Console.logMany` instead")
@val
@scope("console")
@variadic
external logMany: array<'a> => unit = "log"

@deprecated("Do not use. This will be removed in v13")
external eqNull: ('a, null<'a>) => bool = "%equal_null"
@deprecated("Do not use. This will be removed in v13")
external eqUndefined: ('a, undefined<'a>) => bool = "%equal_undefined"
@deprecated("Do not use. This will be removed in v13")
external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"

/* ## Operators */
Expand All @@ -241,22 +267,26 @@ external eqNullable: ('a, nullable<'a>) => bool = "%equal_nullable"
It is marked as unsafe, since it is impossible
to give a proper semantics for comparision which applies to any type
*/
@deprecated("Do not use. This will be removed in v13")
external unsafe_lt: ('a, 'a) => bool = "%unsafe_lt"

/**
`unsafe_le(a, b)` will be compiled as `a <= b`.
See also `Js.unsafe_lt`.
*/
@deprecated("Do not use. This will be removed in v13")
external unsafe_le: ('a, 'a) => bool = "%unsafe_le"

/**
`unsafe_gt(a, b)` will be compiled as `a > b`.
See also `Js.unsafe_lt`.
*/
@deprecated("Do not use. This will be removed in v13")
external unsafe_gt: ('a, 'a) => bool = "%unsafe_gt"

/**
`unsafe_ge(a, b)` will be compiled as `a >= b`.
See also `Js.unsafe_lt`.
*/
@deprecated("Do not use. This will be removed in v13")
external unsafe_ge: ('a, 'a) => bool = "%unsafe_ge"
Loading