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

Better Type Annotations for Realtime Subscriptions #212

Open
Marviel opened this issue Dec 12, 2022 · 0 comments
Open

Better Type Annotations for Realtime Subscriptions #212

Marviel opened this issue Dec 12, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Marviel
Copy link

Marviel commented Dec 12, 2022

Proposed type addition mockup:

export type ColNames = "name" | "type" | "unit" | "value" | "description";
export type FilterOps = "eq" | "ne" | "gt" | "lt" | "ge" | "le";
export type FilterType = `${ColNames}.${FilterOps}=${string}`;

// works!
const works1: FilterType = "name.eq=hello";
// typeerror (non existent column)
const fails1: FilterType = "name.eq=non-existent-column";
// typeerror (bad syntax)
const fails2: FilterType = "name.eq!!!hello";

It would be nice if the realtime subscription string type could be updated to reflect this.

I would submit a full PR except that I think this has implications for some other template types, which I don't have the personal time to dig into right now.

@Marviel Marviel added the enhancement New feature or request label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant