Checking your code
sh
thicket checkcheck type-checks and compile-checks a program. Nothing runs and nothing is written. It prints ok when the program is clean. Otherwise it prints each diagnostic with its file, line, column and severity (error, warning or hint). It exits with code 1 when there is an error. Warnings and hints alone do not fail the check.
Like run, it takes a file, a project folder, or nothing (the nearest thicket.json above the current folder):
sh
thicket check
thicket check app.tks
thicket check ./mygameWhat it catches
Save this as oops.tks:
ts
let score: int = "ten";sh
thicket check oops.tkstext
oops.tks(1,5): error: Cannot assign "ten" to int (variable 'score')
oops.tks(1,5): hint PF012: variable 'score' is declared but never usedThe checker also reports:
- missing type annotations on variables and missing return types on functions (warning
PF071), - unused variables (a hint),
- calls with the wrong number or type of arguments,
- members that a class or interface does not declare,
- a class that says
implementsbut leaves a member out, awaitin the wrong place, and other async mistakes,- a
switch strictthat misses an enum member.
check also reports everything run would refuse at compile time, so a clean check means the program compiles.
Window apps are checked too
You can check a window app on a machine with no display. check never opens a window, so it is a good fit for a build server or a pre-commit hook.
In your editor
The JetBrains plugin runs the same checker through thicket lsp and underlines problems as you type.
Formatting
sh
thicket fmt app.tks
thicket fmt --check app.tksfmt formats a file in place and keeps your comments. --check writes nothing and exits 1 when the file is not formatted.
Silencing one line
When a warning is wrong for one line, suppress it on the line before. The code in brackets limits it to one diagnostic:
ts
// @thicket-ignore-next-line [PF078]
const y: int = legacyRect.width;Next: building a program.