Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/js/async.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub async fn suspend[T, E : Error](
pub fn async_run(f : async () -> Unit) -> Unit = "%async.run"

///|
pub type Promise
pub extern type Promise

///|
pub typealias AsyncOp = () -> Promise
Expand Down
16 changes: 12 additions & 4 deletions src/js/cast.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,39 @@ pub impl Cast for String with into(value) {
}

///|
pub impl Cast for String with from(value) { Value::cast_from(value) }
pub impl Cast for String with from(value) {
Value::cast_from(value)
}

///|
pub impl Cast for Int with into(value) {
checked_cast_int_ffi(value).to_option()
}

///|
pub impl Cast for Int with from(value) { Value::cast_from(value) }
pub impl Cast for Int with from(value) {
Value::cast_from(value)
}

///|
pub impl Cast for Double with into(value) {
checked_cast_double_ffi(value).to_option()
}

///|
pub impl Cast for Double with from(value) { Value::cast_from(value) }
pub impl Cast for Double with from(value) {
Value::cast_from(value)
}

///|
pub impl Cast for Bool with into(value) {
checked_cast_bool_ffi(value).to_option()
}

///|
pub impl Cast for Bool with from(value) { Value::cast_from(value) }
pub impl Cast for Bool with from(value) {
Value::cast_from(value)
}

///|
pub impl[A : Cast] Cast for Array[A] with into(value) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/js.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Optional {
undefined[T]() -> Self[T]
}

pub type Promise
pub extern type Promise

type Symbol
impl Symbol {
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Union8 {
to7[A, B, C, D, E, F, G, H : Cast](Self[A, B, C, D, E, F, G, H]) -> H?
}

pub type Value
pub extern type Value
impl Value {
apply[Arg, Result](Self, Array[Arg]) -> Result
apply_with_index[Arg, Result](Self, Int, Array[Arg]) -> Result
Expand Down
2 changes: 1 addition & 1 deletion src/js/null.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///|
type Nullable[_]
extern type Nullable[_]

///|
pub fn Nullable::is_null[T](self : Nullable[T]) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion src/js/optional.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///|
type Optional[_]
extern type Optional[_]

///|
pub fn Optional::is_undefined[T](self : Optional[T]) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion src/js/symbol.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///|
type Symbol
extern type Symbol

///|
pub fn Symbol::make() -> Symbol {
Expand Down
14 changes: 7 additions & 7 deletions src/js/union.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///| Union type `A | B` for JavaScript values.
type Union2[_, _]
extern type Union2[_, _]

///|
pub fn Union2::to0[A : Cast, B](self : Union2[A, B]) -> A? {
Expand All @@ -22,7 +22,7 @@ pub fn Union2::from1[A, B : Cast](value : B) -> Union2[A, B] {
}

///| Union type `A | B | C` for JavaScript values.
type Union3[_, _, _]
extern type Union3[_, _, _]

///|
pub fn Union3::to0[A : Cast, B, C](self : Union3[A, B, C]) -> A? {
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn Union3::from2[A, B, C : Cast](value : C) -> Union3[A, B, C] {
}

///| Union type `A | B | C | D` for JavaScript values.
type Union4[_, _, _, _]
extern type Union4[_, _, _, _]

///|
pub fn Union4::to0[A : Cast, B, C, D](self : Union4[A, B, C, D]) -> A? {
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn Union4::from3[A, B, C, D : Cast](value : D) -> Union4[A, B, C, D] {
}

///| Union type `A | B | C | D | E` for JavaScript values.
type Union5[_, _, _, _, _]
extern type Union5[_, _, _, _, _]

///|
pub fn Union5::to0[A : Cast, B, C, D, E](self : Union5[A, B, C, D, E]) -> A? {
Expand Down Expand Up @@ -151,7 +151,7 @@ pub fn Union5::from4[A, B, C, D, E : Cast](value : E) -> Union5[A, B, C, D, E] {
}

///| Union type `A | B | C | D | E | F` for JavaScript values.
type Union6[_, _, _, _, _, _]
extern type Union6[_, _, _, _, _, _]

///|
pub fn Union6::to0[A : Cast, B, C, D, E, F](
Expand Down Expand Up @@ -238,7 +238,7 @@ pub fn Union6::from5[A, B, C, D, E, F : Cast](
}

///| Union type `A | B | C | D | E | F | G` for JavaScript values.
type Union7[_, _, _, _, _, _, _]
extern type Union7[_, _, _, _, _, _, _]

///|
pub fn Union7::to0[A : Cast, B, C, D, E, F, G](
Expand Down Expand Up @@ -339,7 +339,7 @@ pub fn Union7::from6[A, B, C, D, E, F, G : Cast](
}

///| Union type `A | B | C | D | E | F | G | H` for JavaScript values.
type Union8[_, _, _, _, _, _, _, _]
extern type Union8[_, _, _, _, _, _, _, _]

///|
pub fn Union8::to0[A : Cast, B, C, D, E, F, G, H](
Expand Down
2 changes: 1 addition & 1 deletion src/js/value.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///|
pub type Value
pub extern type Value

///|
pub fn Value::cast_from[T](value : T) -> Value = "%identity"
Expand Down