-
Notifications
You must be signed in to change notification settings - Fork 9
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
Rest Argument should be add. #25
Comments
Rest arguments are supported but this function does not declare any This function instead takes an object The type of the object does not include a callback field Haxe has stricter rules for structure unification than typescript and will complain sometimes about additional fields This is not something dts2hx can change You could open an issue on the creator type definitions to add the callback field |
Here’s a related issue and explaination I think there’s an argument to be made for allowing extra fields for externs in haxe compiler (maybe we metadata) |
Can you give an example? |
var options: {
var field: String
} = {
field: 'hello',
extra: 'world', // this field is disallowed because it's not included in the structure
// this is done because generally if you're directly assigning to a structure like this, extra fields are usually a typo
} This works however var options = {
field: 'hello',
extra: 'world',
}
function call(options: Options);
call(options); // OK I think if you wrap the field name in quotes it will probably work. Try this Cc.Class({
"callback": function(event, customEventData) {},
}); |
Ahh ok, nothing we can do then |
code from cocos creator .d.ts
it's seem typescript only options this arguments but not limit other arguments
here is piece of haxe test code
callback is not allow here in haxe,but js and typescript can .
maybe you should add some rest Argument for that and unlimit parms in Cc.Class
https://docs.cocos.com/creator/manual/en/components/button.html
The text was updated successfully, but these errors were encountered: