Skip to content

Typescript example without Faker #17

@emersonbottero

Description

@emersonbottero

How can we have typescript support in the basic example show in the docs?

import { createServer, Model } from "miragejs"

export function makeServer({ environment = "development" } = {}) {
  let server = createServer({
    environment,

    models: {
      user: Model,
    },

    seeds(server) {
      server.create("user", { name: "Bob" })
      server.create("user", { name: "Alice" })
    },

    routes() {
      this.namespace = "api"

      this.get("/users", (schema) => {
        return schema.users.all()
      })
    },
  })

  return server
}
´´´

when I tried to set the Model it doesn.t seems to be working.. 

![image](https://github.com/miragejs/examples/assets/12377432/a34b4166-a3dc-44d5-909a-8f8497569c9c)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions