Typechecker: Options

In most cases, running hh_client without any explicit options passed to it is all you will need to do. However, there are options that can be passed to hh_client in order to access code data beyond the typechecking of code.

This section will not cover all the options. To see all the options, you can utilize the help via hh_client --help.

--check

--check is the default command to hh_client, signifying that the typechecker should do what it normally does ... check for type errors.

All of the options below (except the starting and stopping of the server) are actually options to this --check command. The following are equivalent

% hh_client --check [OPTION]
% hh_client [OPTION]

--start

--start (and its sister commands --stop and --restart) should not have to be used often, but they do let you control the Hack server hh_server. You may want to stop the server if you are in a rotten or random state, for example.

--list-modes

--list-modes will print a list of all the files monitored by the Hack server and let you know which of the three modes (or <?php) each file is in.

--search

If you provide this option with a string representing a symbol, then hh_client will search for files it knows about for that symbol, and annotate the results with whether it found a function, class, etc.

--type-at-pos

--type-at-pos tells hh_client to try to determine the type of a specific expression. It takes the following form:

% hh_client --type-at-pos options.php:22:3

where you provide a filename, line number and column number separated by colons. The column number is the hardest part to determine. A variable, for example, is the column of the actual start of the name of the variable, not including the $.

--lint

The Hack typechecker has a limited linter. Currently it checks to see if you are using the uppercase TRUE, FALSE and NULL and suggests you use the lowercase true, false and null instead. Other linter features may be added in the future.

This option is currently available on a specific file basis. You must specify a single file to be linted.