Page 1 of 1

[TypeScript] DataField docs and typings

Posted: Sun Aug 07, 2022 12:02 pm
by pmiklashevich

Hello team!

Please introduce the 'type' on your DataField and all its children.

If you look at the docs of StringDataField you can see it recommends to create a new Model and pass an array of field configs specifying the "type". So this config should be public.

class Person extends Model {
    static get fields() {
        return [
            { name : 'name', type : 'string' }

When I extend the Model class and specify the fields, I get the following error:

Object literal may only specify known properties, and 'type' does not exist in type 'Partial<DataFieldConfig>'.

Class definition:

import { Model, DataFieldConfig } from '@bryntum/schedulerpro'

class GroupModel extends Model {
    static get $name(): string {
        return 'GroupModel'

static get fields(): Partial<DataFieldConfig>[] {
    return [
        { name: 'title', type: 'string' },
        { name: 'players', type: 'array' },
        { name: 'teamId', type: 'int', dataSource: 'team_id' },

export default GroupModel
Screen Shot 2022-08-07 at 12.51.46.png
Screen Shot 2022-08-07 at 12.51.46.png (223.74 KiB) Viewed 143 times

If we look at the schedulerpro-5.1.1/build/schedulerpro.d.ts file and search for DataFieldConfig, we don't see "type" in the list of fields.

    type DataFieldConfig = {
        alwaysWrite: boolean
        column: string|object
        compare: Function
        dataSource: string
        defaultValue: any
        internal: boolean
        label: string
        name: string
        nullText: string
        nullValue: any
        nullable: boolean
        persist: boolean
        readOnly: boolean
Screen Shot 2022-08-07 at 12.50.59.png
Screen Shot 2022-08-07 at 12.50.59.png (453.75 KiB) Viewed 143 times

Please improve the docs and typings.


Re: [TypeScript] DataField docs and typings

Posted: Mon Aug 08, 2022 9:48 am
by alex.l

Hi Pavel,

Thank you for the report, here is a ticket