Full reference for all TypeSharp CLI commands and flags.
| Command | Description |
|---|---|
| typesharp init | Scaffold a typesharp.config.ts file in the current directory. |
| typesharp | Run type generation using the config file in the current directory. |
| typesharp generate | Explicitly run type generation. |
| typesharp generate --config ./my-config.json | Run generation with a custom config path. |
| typesharp generate --watch | Watch for C# file changes and regenerate types automatically. |
npx typesharp npx typesharp generate --config ./configs/my-config.json npx typesharp init --format json npx typesharp watch | Flag | Type | Default | Description |
|---|---|---|---|
| --config, -c | string | auto | Path to a custom config file. Auto-discovers typesharp.config.ts | .js | .json if omitted. |
| --format | string | ts | Config format for init command: ts | js | json |
| --no-incremental | boolean | false | Disables incremental mode — clears and regenerates all output files. |
Watch mode regenerates types automatically whenever a .cs file changes. Uses debouncing and incremental generation — only changed files are re-processed.
npx typesharp watch npx typesharp watch --no-incremental Instead of passing flags every time, create a config file at your project root. TypeSharp auto-discovers typesharp.config.ts, .json, or .js.
import type { TypeSharpConfig } from '@siyavuyachagi/typesharp'; const config: TypeSharpConfig = { source: ['C:/Users/User/Desktop/MyApp/MyApp.slnx'], outputPath: './app/types', singleOutputFile: false, namingConvention: 'camel', fileSuffix: '' } export default config