0.9.0 • Published 3 years ago

mock-type v0.9.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

mock-type

a tool to create mock data from typescript interfaces, inspired by intermock

Installation

npm install --global mock-type

Usage

Suppose we have a file named model.ts under current directory, which content is like:

interface User {
  name: string
}

we can mock data by this:

mock-type -f ./model.ts --interfaces "User"

If you want to write mock data to file, just add outFile option:

mock-type -f ./model.ts --interfaces "User" --outFile "./mock.ts"

Why

Since intermock is not active, and don't support some important features like:

  1. don't support nested type literal
interface Student {
  name: string,
  grade: {
    math: number,
    english: number
  }
}
  1. don't support array consist of primitive data
interface Group {
  memebers: Array<string>
}
  1. don't support multiple files
interface Admin {
  role: User // User interface located in another file
}
0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago