Skip to content

Commit 05d6517

Browse files
authored
Merge pull request #2742 from cristianoc/deprecate_js_boolean
Deprecate type Js.boolean
2 parents 6866580 + 30c6e16 commit 05d6517

File tree

11 files changed

+36
-34
lines changed

11 files changed

+36
-34
lines changed

jscomp/others/js_boolean.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
(** Contains functions for dealing with JavaScript booleans *)
2626

27-
external to_js_boolean : bool -> Js.boolean = "%identity"
27+
external to_js_boolean : bool -> bool = "%identity"
2828

jscomp/others/js_boolean.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
(** Contains functions for dealing with JavaScript booleans *)
2626

27-
external to_js_boolean : bool -> Js.boolean = "%identity"
27+
external to_js_boolean : bool -> bool = "%identity"
2828
[@@ocaml.deprecated "This function is not needed any more"]

jscomp/others/js_json.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type _ kind =
3131
| Number : float kind
3232
| Object : t Js_dict.t kind
3333
| Array : t array kind
34-
| Boolean : Js.boolean kind
34+
| Boolean : bool kind
3535
| Null : Js_types.null_val kind
3636

3737

@@ -94,7 +94,7 @@ let decodeArray json =
9494

9595
let decodeBoolean json =
9696
if Js.typeof json = "boolean"
97-
then Some (Obj.magic (json:t) : Js.boolean)
97+
then Some (Obj.magic (json:t) : bool)
9898
else None
9999

100100
let decodeNull json =
@@ -115,15 +115,15 @@ external stringifyAny : 'a -> string option =
115115
external null : t = "" [@@bs.val]
116116
external string : string -> t = "%identity"
117117
external number : float -> t = "%identity"
118-
external boolean : Js.boolean -> t = "%identity"
118+
external boolean : bool -> t = "%identity"
119119
external object_ : t Js_dict.t -> t = "%identity"
120120

121121
external array_ : t array -> t = "%identity"
122122

123123
external array : t array -> t = "%identity"
124124
external stringArray : string array -> t = "%identity"
125125
external numberArray : float array -> t = "%identity"
126-
external booleanArray : Js.boolean array -> t = "%identity"
126+
external booleanArray : bool array -> t = "%identity"
127127
external objectArray : t Js_dict.t array -> t = "%identity"
128128
external stringify: t -> string = "stringify"
129129
[@@bs.val] [@@bs.scope "JSON"]

jscomp/others/js_json.mli

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type _ kind =
3838
| Number : float kind
3939
| Object : t Js_dict.t kind
4040
| Array : t array kind
41-
| Boolean : Js.boolean kind
41+
| Boolean : bool kind
4242
| Null : Js_types.null_val kind
4343

4444
type tagged_t =
@@ -75,7 +75,7 @@ val decodeArray : t -> t array option
7575
(** [decodeArray json] returns [Some a] if [json] is an array, [None]
7676
otherwise *)
7777

78-
val decodeBoolean : t -> Js.boolean option
78+
val decodeBoolean : t -> bool option
7979
(** [decodeBoolean json] returns [Some b] if [json] is a boolean, [None]
8080
otherwise *)
8181

@@ -98,8 +98,8 @@ external string : string -> t = "%identity"
9898
external number : float -> t = "%identity"
9999
(** [number n] makes a JSON number of the [float] [n] *)
100100

101-
external boolean : Js.boolean -> t = "%identity"
102-
(** [boolean b] makes a JSON boolean of the [Js.boolean] [b] *)
101+
external boolean : bool -> t = "%identity"
102+
(** [boolean b] makes a JSON boolean of the [bool] [b] *)
103103

104104
external object_ : t Js_dict.t -> t = "%identity"
105105
(** [object_ dict] makes a JSON objet of the [Js.Dict.t] [dict] *)
@@ -118,8 +118,8 @@ external stringArray : string array -> t = "%identity"
118118
external numberArray : float array -> t = "%identity"
119119
(** [numberArray a] makes a JSON array of the [float array] [a] *)
120120

121-
external booleanArray : Js.boolean array -> t = "%identity"
122-
(** [booleanArray] makes a JSON array of the [Js.boolean array] [a] *)
121+
external booleanArray : bool array -> t = "%identity"
122+
(** [booleanArray] makes a JSON array of the [bool array] [a] *)
123123

124124
external objectArray : t Js_dict.t array -> t = "%identity"
125125
(** [objectArray a] makes a JSON array of the [JsDict.t array] [a] *)

jscomp/others/js_types.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type function_val
3737
type _ t =
3838
| Undefined : undefined_val t
3939
| Null : null_val t
40-
| Boolean : Js.boolean t
40+
| Boolean : bool t
4141
| Number : float t
4242
| String : string t
4343
| Function : function_val t

jscomp/others/js_types.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type function_val
3838
type _ t =
3939
| Undefined : undefined_val t
4040
| Null : null_val t
41-
| Boolean : Js.boolean t
41+
| Boolean : bool t
4242
| Number : float t
4343
| String : string t
4444
| Function : function_val t

jscomp/others/node.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type node_module = <
4545

4646
filename : string ;
4747

48-
loaded : Js.boolean;
48+
loaded : bool;
4949
children : node_module array ;
5050
paths : string array;
5151
> Js.t

jscomp/others/node_fs.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ module Watch = struct
4747
type t
4848
type config
4949
external config :
50-
?persistent:Js.boolean ->
51-
?recursive:Js.boolean ->
50+
?persistent: bool ->
51+
?recursive: bool ->
5252
?encoding: Js_string.t ->
5353
unit -> config =
5454
"" [@@bs.obj]

jscomp/runtime/caml_basic.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
val none : 'a option
2929
val some : 'a -> 'a option
30-
val is_none : 'a option -> Js.boolean
30+
val is_none : 'a option -> bool
3131
val to_def : 'a option -> 'a Js_undefined.t
3232
val cons : 'a -> 'a list -> 'a list
33-
val is_list_empty : 'a list -> Js.boolean
33+
val is_list_empty : 'a list -> bool

jscomp/runtime/js.mli

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ external test : 'a nullable -> bool = "#is_nil_undef"
8383
external testAny : 'a -> bool = "#is_nil_undef"
8484

8585
type boolean = bool
86+
[@@ocaml.deprecated "Use type bool instead"]
8687
(** The value could be either {!Js.true_} or {!Js.false_}.
8788
Note in BuckleScript, [boolean] has different representation from OCaml's [bool],
8889
see conversion functions in {!Boolean} *)
@@ -93,10 +94,10 @@ type (+'a, +'e) promise
9394
*)
9495

9596

96-
val true_ : boolean
97+
val true_ : bool
9798
[@@ocaml.deprecated "Use true directly"]
9899

99-
val false_ : boolean
100+
val false_ : bool
100101
[@@ocaml.deprecated "Use false directly"]
101102

102103
external null : 'a null = "#null"
@@ -106,7 +107,8 @@ external undefined : 'a undefined = "#undefined"
106107
(** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*)
107108

108109

109-
external to_bool : boolean -> bool = "%identity"
110+
external to_bool : bool -> bool = "%identity"
111+
[@@ocaml.deprecated "This function is not needed any more"]
110112
(** convert Js boolean to OCaml bool *)
111113

112114
external typeof : 'a -> string = "#typeof"

0 commit comments

Comments
 (0)