Saffron supports strongly-typed arguments and configuration schemas. If type definitions exist for these, they may be passed to Saffron as type arguments and Saffron will ensure that the data passed to your handler is appropriately typed:
cli.ts
import*as cli from'@darkobits/saffron';interfaceSchema { spline:string; algorithm:'RTA-20'|'RTA-21'|'RTA-22';}cli.command<Schema>({handler: ({ argv, config }) => {// argv is of type Schema.// config is of type Schema. }});cli.init();
If the schema for your application's arguments and configuration differs, a second type argument may be provided to distinguish the argument schema from the configuration schema:
cli.ts
import*as cli from'@darkobits/saffron';interfaceArguments { spline:string; algorithm:'RTA-20'|'RTA-21'|'RTA-22';}interfaceConfiguration {// Configuration schema here.}cli.command<Arguments,Configuration>({handler: ({ argv, config }) => {// argv is of type Arguments.// config is of type Configuration. }});cli.init();