tsdjs / tsd

Check TypeScript type definitions
MIT License
2.38k stars 68 forks source link

Update CLI Documentation and Add `--typings` and `--files` Flags #158

Closed tommy-mitchell closed 1 year ago

tommy-mitchell commented 1 year ago

Many issues have been opened expressing confusion about error messages (#151, #92, etc.) or requesting more configuration (#150, #132). This PR adds documentation about tsd CLI usage (such as why the infamous The type definition `index.d.ts` does not exist. Create one and try again. appears) and improves the error messages to be more verbose.

In addition, it also exposes the typingsFile and testFiles options to the CLI via flags:

$ tsd --typings 'specific.d.ts' --files 'test/specific-1/*.ts' --files 'test/specific-2/*.ts'

Both have short-form aliases. I've also added aliases for --help and --version, and added all four to the CLI help message:

Usage
  $ tsd [path]

  The given directory must contain a package.json and a typings file.

Info
  --help,    -h  Display help text
  --version, -v  Display version info

Options
  --typings, -t  Type definition file to test  [Default: "types" property in package.json]
  --files,   -f  Glob of files to test         [Default: /path/test-d/**/*.test-d.ts or .tsx]

Examples
  $ tsd /path/to/project

  $ tsd --files /test/some/folder/*.ts --files /test/other/folder/*.tsx

  $ tsd

    index.test-d.ts
    ✖  10:20  Argument of type string is not assignable to parameter of type number.

This would close #151, close #150, and close #132.

sindresorhus commented 1 year ago

Can you fix the merge conflict?

tommy-mitchell commented 1 year ago

Merged.

sindresorhus commented 1 year ago

Can you fix the conflict?

tommy-mitchell commented 1 year ago

Merged.