Skip to content

Allow null values for ts-force-gen PICKLIST enums #159

@saulhoward

Description

@saulhoward

I would like the option to allow null values for PICKLISTs generated by ts-force-gen.

When making RestObject Updates, setting fields to null tells Salesforce to unset that field:

acc.somePicklist = null; // Type is not assignable to type:
await acc.update(); 

The above code shows a TS error because ts-force-gen generated non-nullable enums:

    public somePicklist?: PicklistConst<typeof Account.PICKLIST.somePicklist>;

ts-force-gen was run with:

"enforcePicklistValues": "ALL",
"generatePicklists": true

I see that all the other generated types are nullable, so perhaps this has been missed? Alternatively, maybe the intended behaviour of enforcePicklistValues is to omit nulls. If this is the case, it's a shame as I would like strict enums and nulls.

Many thanks for a great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions