Skip to content

Add Model Field Typing #14

@parker-codes

Description

@parker-codes

This should be relatively simple, but to have better TS support we should add the returned fields as typed properties on each model. This helps with autocomplete (even for JS users) and will overall tighten up the project code.

Currently the only fields being typed are mostly things that should be private to the package:

class Row {
API: API;
id?: string;
docId?: string;
tableId?: string;
values?: any;

A solution could be to create an interface for RowFields or something like that which has all of the fields returned from the Coda API. This interface can be used to type the create/update methods instead of using any:

async update(row: any): Promise<boolean> {

It's possible that we may need to add the fields to the main model as well as have interfaces for each individual CRUD operation that needs it though, in case some take different options.

We'll also want to mark some of the current fields as private so that they aren't exposed outside of the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions