Skip to content

Commit b1c40bf

Browse files
committed
Added overloads to "TypeOf" method.
Attribute of "InstanceOf" changed to "GenericBinary".
1 parent 30d7bbd commit b1c40bf

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

CSharpToJavaScript/APIs/JS/GlobalObject.cs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CSharpToJavaScript.Utils;
2+
using System;
23

34
namespace CSharpToJavaScript.APIs.JS.Ecma;
45

@@ -61,7 +62,7 @@ public static Undefined Void(dynamic arg)
6162
{
6263
return new Undefined();
6364
}
64-
65+
6566
/// <summary>
6667
/// Translates this method into the "typeof" operator.
6768
/// </summary>
@@ -71,7 +72,33 @@ public static Undefined Void(dynamic arg)
7172
/// <param name="operand">An expression representing the object or primitive whose type is to be returned.</param>
7273
/// <returns>string</returns>
7374
[Unary("typeof ")]
74-
public static string TypeOf(dynamic operand)
75+
public static string TypeOf(object operand)
76+
{
77+
return string.Empty;
78+
}
79+
/// <summary>
80+
/// Translates this method into the "typeof" operator.
81+
/// </summary>
82+
/// <remarks>
83+
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
84+
/// </remarks>
85+
/// <param name="operand">An expression representing the object or primitive whose type is to be returned.</param>
86+
/// <returns>string</returns>
87+
[Unary("typeof ")]
88+
public static string TypeOf(Func<dynamic> operand)
89+
{
90+
return string.Empty;
91+
}
92+
/// <summary>
93+
/// Translates this method into the "typeof" operator.
94+
/// </summary>
95+
/// <remarks>
96+
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
97+
/// </remarks>
98+
/// <typeparam name="O">An expression representing the object or primitive whose type is to be returned.</typeparam>
99+
/// <returns>string</returns>
100+
[GenericUnary("typeof ")]
101+
public static string TypeOf<O>()
75102
{
76103
return string.Empty;
77104
}
@@ -82,15 +109,14 @@ public static string TypeOf(dynamic operand)
82109
/// <remarks>
83110
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
84111
/// </remarks>
112+
/// <typeparam name="C">Constructor to test against.</typeparam>
85113
/// <param name="obj">The object to test.</param>
86-
/// <param name="constructor">Constructor to test against.</param>
87114
/// <returns>bool</returns>
88-
[Binary("instanceof")]
89-
public static bool InstanceOf(dynamic obj, dynamic constructor)
115+
[GenericBinary(" instanceof ")]
116+
public static bool InstanceOf<C>(dynamic obj)
90117
{
91118
return true;
92119
}
93-
94120
/// <summary>
95121
/// Translates this method into the "in" operator.
96122
/// </summary>

0 commit comments

Comments
 (0)