Our blazing fast Grid component built with pure JavaScript


Post by henrique »

Hi!

I need some help to change the declaration of some classes in the TS file. Almost all classes that's extends DataField class, the constructor are declared with generic array object, but all classes has a type config declaration, is it possible to change the declaration to the correct type in the constructors, like the BooleanDataField?


Post by sergey.maltsev »

Hi!

You could declare your own constructor if you want.

Like it is declared for BooleanDataField

type BooleanDataFieldConfig = {
...
}

class BooleanDataField extends DataField {
    constructor(config?: Partial<BooleanDataFieldConfig>);
}

Could you please give some sample code to see what you need?


Post by henrique »

Hi!

This is the NumberDataField declaration in TS file, but the class is declared with a generic constructor.

export class NumberDataField extends DataField {
    /**
     * Base constructor, passes arguments to [construct](https://bryntum.com/products/grid/docs/api/Core/Base#function-construct).
     * @param {object} args Usually called with a config object, but accepts any params
     */
    constructor(...args: object[]);
}

The ideal declaration is like this:

export class NumberDataField extends DataField {
    /**
     * Base constructor, passes arguments to [construct](https://bryntum.com/products/grid/docs/api/Core/Base#function-construct).
     * @param {object} args Usually called with a config object, but accepts any params
     */
    constructor(config?: Partial<NumberDataFieldConfig>);
}

This "problem" exists in almost all DataField classes, this is the "fix" I'm suggesting.


Post by sergey.maltsev »

Hi!

Thank you for reporting this.

I've created this issue to fix
https://github.com/bryntum/support/issues/8547


Post Reply