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

Schema methods in Getting Started/Overview (Typescript) #841

Open
zackrdavis opened this issue Jul 21, 2020 · 1 comment
Open

Schema methods in Getting Started/Overview (Typescript) #841

zackrdavis opened this issue Jul 21, 2020 · 1 comment

Comments

@zackrdavis
Copy link

zackrdavis commented Jul 21, 2020

First of all, thank you for Mirage! It fits my needs exactly. MSW requires an HTTPS connection to host, which was a time-suck and finally a dealbreaker for our S3-hosted staging.

I hit some confusion when I got to the section on dynamic route handlers, specifically:
schema.movies.all() versus schema.all('movie')

The first gave me a TS error, the second did not, and because I'm new to Typescript it held me up for a little while. Maybe worth a change to the docs or a change to the types (which I wouldn't know how to do).

Thanks again for a very helpful library!

@samselikoff
Copy link
Contributor

samselikoff commented Jul 21, 2020

Thanks for the kind words!

Hm – I still am not super familiar with TS, but we might have to ask some of the folks that worked on it.

Back when I first wrote the schema APIs I wanted to mimic Mongo, so schema.movies.all(), schema.movies.where({}), etc. has always been the public API for accessing data.

@dfreeman / @chriskrycho / @zoltan-nz, any chance you know if schema.movies.all() should be valid from Typescript's perspective?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants