On Mon, Nov 19, 2018 at 8:54 AM Tony Houghton <h...@realh.co.uk> wrote:

> On Fri, 16 Nov 2018 at 18:07, <makep...@firemail.cc> wrote:
>
>> A generic seems appropriate, here's how you can start:
>>
>> ```ts
>> export function registerClass<T>(klass: T): T & Partial<{
>>    [interfaces]: any[]
>>    [properties]: any
>>    [requires]: any[]
>>    [signals]: any
>> }>`
>> ```
>>
>
> OK. I forgot that there is an optional first argument to registerClass
> which is an object containing the various GObject things such as properties
> and signals to be added to the class. In most languages optional arguments
> have to come last; can Typescript handle them coming first?
>

The optional argument only exists as part of the "transitional" API that I
described in my previous message. The version without the argument is the
form intended to use in decorators and with class data members. The version
with the argument is more convenient in current JS.

I would suggest binding only one of the two forms in any case.

Regards,
Philip
_______________________________________________
javascript-list mailing list
javascript-list@gnome.org
https://mail.gnome.org/mailman/listinfo/javascript-list

Reply via email to