Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    smartclient.d.ts: Properties (fields and methods) should be optional

    SmartClient Version: v12.0p_2019-07-11/LGPL Development Only (built 2019-07-11)

    While some places (ex: List) have properties and methods marked optional, there are some classes where they are not (ex: ListGridField). I have a method that generates them with the following code:

    Code:
    //Code which defines dataField, title, displayWidth, and isHidden
    
    var output : isc.ListGridField = {
        name: dataField,
        title: title,
        canEdit: false,
        width: displayWidth,
        hidden: isHidden
    }
    
    return output;
    Without marking them optional, TypeScript will complain that over 100 properties have not been defined.

    Note: If you've found this thread because you're having this issue, then the way to fix it is to open smartclient.d.ts and find the relevant class/interface and add ? to the places that should be optional.

    Example (field):
    Code:
    exportFieldWidth: boolean;
    ... turns into...
    Code:
    exportFieldWidth?: boolean;
    Example (method):
    Code:
    sortNormalizer(recordObject: object, fieldName: string, context:ListGrid): any;
    ... turns into...
    Code:
    sortNormalizer?(recordObject: object, fieldName: string, context:ListGrid): any;

    #2
    This makes sense, thanks. New file with optional params will be in the August 9th 2019 build!

    Comment

    Working...
    X