-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Labels
Description
If a host method has void
return type, an object typed Microsoft.ClearScript.VoidResult
will be returned when the method is called from script side. For example:
// C# side
public void MyMethod() { }
// Javascript side
var result = myClass.MyMethod();
var isUndefined = result === undefined; // false
var isNullish = result == null; // false
As discussed in issue #298, toFunction
can be used or the function can be wrapped to basically customize this behavior. But I am questioning if there is any use case where returning VoidResult
to script side is useful.
Maybe it can return undefined
or Microsoft.ClearScript.Undefined
(I don't know if those two would be the same thing). Or there could be a configuration for this like VoidExportValue
, like how there is a configuration for UndefinedImportValue
(which is a life-saver for me tbh).