Getting Started
CLI basics
Choose between the REPL, interpreter, compiler, and project checking commands.
Tested with SharpTS 0.0.0-local+7c601010The SharpTS CLI grows with your task: start interactively, run a file, compile an assembly, or produce an executable where the target supports it.
Open the REPL
Run SharpTS without a file to open its read-evaluate-print loop:
sharptsUse the REPL for quick expressions and short experiments.
Type-check and interpret a file
Pass an entry file for the fastest edit-run cycle:
sharpts app.tsSharpTS type-checks app.ts and then interprets it.
Compile a .NET assembly
Add --compile to produce app.dll:
sharpts --compile app.ts
dotnet app.dllCompilation is useful for distribution and .NET integration.
Compile an executable
Select the executable target where the operating system and SharpTS package support it:
sharpts --compile app.ts -t exePass arguments to a script
Use -- to stop SharpTS option parsing. Everything after it belongs to the script:
sharpts report.ts -- --format jsonThis prevents a script option such as --format from being interpreted as a SharpTS option.
Start with project checking
SharpTS automatically discovers a nearby tsconfig.json. These options cover the first project-level tasks:
-p path/to/tsconfig.jsonselects an explicit project.--strictenables stricter checking.--noEmitchecks without producing output.--helpshows the complete, current option set.
Project commands can check a TypeScript import graph. A runtime command still needs an entry point:
script.tsidentifies a file to interpret, while--compile script.tsidentifies a file to compile.
Choose this command when
- Use
sharptswhen you want an interactive prompt. - Use
sharpts app.tswhen you want to check and run a file immediately. - Use
sharpts --compile app.tswhen you want a .NET assembly. - Use
sharpts --compile app.ts -t exewhen you want a supported executable target. - Use
sharpts --noEmit -p tsconfig.jsonwhen you only want to check a project graph.
Advanced compiler, reference, packaging, and diagnostic flags belong in the future CLI reference. Use sharpts --help for the complete option set available in your installed version.