Skip to content

Commit

Permalink
chore: add some jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 7, 2024
1 parent 6d8ba64 commit de495ee
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ import { config } from './config'
import { extract } from './extract'
import { checkIsolatedDeclarations, getAllTypeScriptFiles, writeToFile } from './utils'

/**
* Generate declaration files from TypeScript files.
* @param options - Generation options.
* @returns Promise<void>
* @example ```ts
* // Generate declaration files from all TypeScript files in the src directory.
* const options = {
* cwd: process.cwd(),
* root: './src',
* outdir: './dist',
* clean: true,
* verbose: false,
* }
*
* await generateDeclarationsFromFiles(options)
*/
export async function generateDeclarationsFromFiles(options?: DtsGenerationConfig): Promise<void> {
try {
// Check for isolatedModules setting
Expand Down Expand Up @@ -51,6 +67,22 @@ export async function generateDeclarationsFromFiles(options?: DtsGenerationConfi
}
}

/**
* Generate TypeScript declaration files.
* @param options - Generation options.
* @returns Promise<void>
* @example ```ts
* // Generate declaration files from all TypeScript files in the src directory.
* const options = {
* cwd: process.cwd(),
* root: './src',
* outdir: './dist',
* clean: true,
* verbose: false,
* }
*
* await generate(options)
*/
export async function generate(options?: DtsGenerationOption): Promise<void> {
await generateDeclarationsFromFiles({ ...config, ...options })
}

0 comments on commit de495ee

Please sign in to comment.