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

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

Merged
merged 11 commits into from Sep 14, 2022

Conversation

tommy-mitchell
Copy link
Contributor

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
Copy link
Collaborator

Can you fix the merge conflict?

@tommy-mitchell
Copy link
Contributor Author

Merged.

source/cli.ts Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Collaborator

Can you fix the conflict?

@tommy-mitchell
Copy link
Contributor Author

Merged.

@sindresorhus sindresorhus merged commit e251852 into tsdjs:main Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants