Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Model Field Typing #14

Open
parker-codes opened this issue Jul 23, 2020 · 2 comments
Open

Add Model Field Typing #14

parker-codes opened this issue Jul 23, 2020 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@parker-codes
Copy link
Owner

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.

@parker-codes parker-codes added enhancement New feature or request help wanted Extra attention is needed labels Jul 23, 2020
@github-actions
Copy link

Thanks for creating your first issue for coda-js and contributing!

@parker-codes
Copy link
Owner Author

Thank you, bot! 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant