site
site copied to clipboard
Schema methods in Getting Started/Overview (Typescript)
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!
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?