// docs / cli-reference

CLI Reference

Full reference for all TypeSharp CLI commands and flags.

Commands

CommandDescription
typesharp initScaffold a typesharp.config.ts file in the current directory.
typesharpRun type generation using the config file in the current directory.
typesharp generateExplicitly run type generation.
typesharp generate --config ./my-config.jsonRun generation with a custom config path.
typesharp generate --watchWatch for C# file changes and regenerate types automatically.

Usage

 npx typesharp
  npx typesharp generate --config ./configs/my-config.json 
  npx typesharp init --format json 
  npx typesharp watch 

Flags

FlagTypeDefaultDescription
--config, -cstringautoPath to a custom config file. Auto-discovers typesharp.config.ts | .js | .json if omitted.
--formatstringtsConfig format for init command: ts | js | json
--no-incrementalbooleanfalseDisables incremental mode — clears and regenerates all output files.

Watch mode

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 

Config file

Instead of passing flags every time, create a config file at your project root. TypeSharp auto-discovers typesharp.config.ts, .json, or .js.

typesharp.config.ts — typesharp
typesharp.config.ts
typesharp.config.json
typesharp.config.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
{
"source": ["C:/Users/User/Desktop/MyApp/MyApp.slnx"],
"outputPath": "./app/types",
"singleOutputFile": false,
"namingConvention": "camel",
"fileSuffix": ""
}
/** @type {import('@siyavuyachagi/typesharp').TypeSharpConfig} */
const config = {
source: ['C:/Users/User/Desktop/MyApp/MyApp.slnx'],
outputPath: './app/types',
singleOutputFile: false,
namingConvention: 'camel',
fileSuffix: ''
}

module.exports = config
⎇ main✓ Prettier
typescriptUTF-8Ln 1, Col 1