CLI Reference
generate-ts
Generates TypeScript type definitions for the specified schema and writes them to the specified file.
Usage
typesync generate-ts --definition <filePathOrPattern> --target <targetEnvironment> --outFile <filePath> --indentation <indentation> --debug <debug>
Options
definition
string
requiredThe exact path or a Glob pattern to the definition file or files. Each definition file must be a YAML or JSON file containing model definitions.
- Example single file path:
definition/models.json
- Example Glob pattern:
'definition/**/*.yml'
target
string
requiredThe target environment for which the types are generated. This option specifies the target SDK and version, ensuring that the output is compatible with the chosen environment. See the list of available targets here.
outFile
string
requiredThe path to the output file.
objectTypeFormat
"interface" | "type-alias"
default: "interface"Controls how objects are defined in the TypeScript output. Object types can be represented either by interfaces or type aliases.
indentation
int
default: 2Indentation or tab width for the generated code.
debug
boolean
default: falseWhether to enable debug logs.
Targets
firebase-admin@12
: For backend projects that rely on the Firebase Admin Node.js SDK (v12).firebase-admin@11
: For backend projects that rely on the Firebase Admin Node.js SDK (v11).firebase@10
: For frontend projects that rely on the Firebase Javascript SDK (v10).firebase@9
: For frontend projects that rely on the Firebase Javascript SDK (v9).