1import{_ as t,i,o as n,ak as a}from"./chunks/framework.Da91f1N-.js";const g=JSON.parse('{"title":"Features","description":"","frontmatter":{},"headers":[],"relativePath":"features/index.md","filePath":"features/index.md"}'),o={name:"features/index.md"};function r(s,e,l,d,c,u){return n(),i("div",null,e[0]||(e[0]=[a(`<h1 id="features" tabindex="-1">Features <a class="header-anchor" href="#features" aria-label="Permalink to "Features"">â</a></h1><p>dtsx provides a comprehensive set of features for generating TypeScript declaration files. Here are the key features:</p><h2 id="core-features" tabindex="-1">Core Features <a class="header-anchor" href="#core-features" aria-label="Permalink to "Core Features"">â</a></h2><ul><li><strong>â¡ Fast TypeScript Declaration Generation</strong>: Generate <code>.d.ts</code> files quickly and efficiently using Bun's optimized runtime</li><li><strong>ð§ Smart Import Optimization</strong>: Automatically optimizes imports based on actual usage and removes unused imports</li><li><strong>ð§ Intelligent Type Inference</strong>: Advanced type inference for complex structures, including narrow types for constants</li><li><strong>ð¬ Comment Preservation</strong>: Maintains JSDoc and other documentation comments in generated declarations (enabled by default)</li><li><strong>ð Multi-line Type Formatting</strong>: Properly formats complex multi-line type definitions with correct indentation</li><li><strong>ðï¸ Flexible Output Structure</strong>: Choose between mirroring source structure or flat output organization</li></ul><h2 id="type-support" tabindex="-1">Type Support <a class="header-anchor" href="#type-support" aria-label="Permalink to "Type Support"">â</a></h2><p>dtsx supports all TypeScript declaration types:</p><h3 id="basic-types" tabindex="-1">Basic Types <a class="header-anchor" href="#basic-types" aria-label="Permalink to "Basic Types"">â</a></h3><ul><li><strong>Interfaces and Type Aliases</strong>: Full support with generics, extends, and complex inheritance</li><li><strong>Functions and Methods</strong>: Including overloads, generics, async functions, and generators</li><li><strong>Classes</strong>: With constructors, methods, properties, inheritance, and access modifiers</li><li><strong>Enums</strong>: Both numeric and string enums with member comments</li><li><strong>Variables</strong>: const, let, var declarations with proper type inference</li></ul><h3 id="advanced-types" tabindex="-1">Advanced Types <a class="header-anchor" href="#advanced-types" aria-label="Permalink to "Advanced Types"">â</a></h3><ul><li><strong>Modules and Namespaces</strong>: Nested declarations and proper scoping</li><li><strong>Generics</strong>: Type parameters, constraints, and default types</li><li><strong>Union/Intersection Types</strong>: Complex type combinations</li><li><strong>Conditional Types</strong>: Type-level conditionals and mappings</li><li><strong>Mapped Types</strong>: Property transformations and key remapping</li><li><strong>Template Literal Types</strong>: String manipulation at type level</li><li><strong>Utility Types</strong>: Built-in and custom utility type support</li></ul><h3 id="import-export-handling" tabindex="-1">Import/Export Handling <a class="header-anchor" href="#import-export-handling" aria-label="Permalink to "Import/Export Handling"">â</a></h3><ul><li><strong>ES6 Imports/Exports</strong>: Named, default, and namespace imports</li><li><strong>Type-only Imports</strong>: Proper handling of <code>import type</code> statements</li><li><strong>Re-exports</strong>: Export forwarding and barrel exports</li><li><strong>Dynamic Imports</strong>: Type-safe dynamic import declarations</li></ul><h2 id="configuration-options" tabindex="-1">Configuration Options <a class="header-anchor" href="#configuration-options" aria-label="Permalink to "Configuration Options"">â</a></h2><h3 id="core-configuration" tabindex="-1">Core Configuration <a class="header-anchor" href="#core-configuration" aria-label="Permalink to "Core Configuration"">â</a></h3><ul><li><strong>Source Root Directory</strong>: Configurable source directory (<code>root</code>)</li><li><strong>Entry Point Specification</strong>: Glob patterns for flexible file selection (<code>entrypoints</code>)</li><li><strong>Output Directory Control</strong>: Customizable output location (<code>outdir</code>)</li><li><strong>Working Directory</strong>: Configurable current working directory (<code>cwd</code>)</li></ul><h3 id="generation-options" tabindex="-1">Generation Options <a class="header-anchor" href="#generation-options" aria-label="Permalink to "Generation Options"">â</a></h3><ul><li><strong>Comment Preservation</strong>: Toggle JSDoc and comment preservation (<code>keepComments</code>)</li><li><strong>Clean Output</strong>: Automatic cleanup of output directory (<code>clean</code>)</li><li><strong>Output Structure</strong>: Mirror source structure or flat output (<code>outputStructure</code>)</li><li><strong>TypeScript Configuration</strong>: Custom tsconfig.json path (<code>tsconfigPath</code>)</li></ul><h3 id="development-options" tabindex="-1">Development Options <a class="header-anchor" href="#development-options" aria-label="Permalink to "Development Options"">â</a></h3><ul><li><strong>Verbose Logging</strong>: Detailed generation logs for debugging (<code>verbose</code>)</li><li><strong>Isolated Declarations</strong>: Automatic detection and validation</li><li><strong>Error Handling</strong>: Comprehensive error reporting and validation</li></ul><h2 id="comment-preservation" tabindex="-1">Comment Preservation <a class="header-anchor" href="#comment-preservation" aria-label="Permalink to "Comment Preservation"">â</a></h2><p>When <code>keepComments: true</code> (default), dtsx preserves:</p><h3 id="jsdoc-comments" tabindex="-1">JSDoc Comments <a class="header-anchor" href="#jsdoc-comments" aria-label="Permalink to "JSDoc Comments"">â</a></h3><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span>
1<pre class="shiki shiki-themes github-light github-dark vp-code" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/**</span></span> 2<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * User interface with comprehensive documentation</span></span> 3<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">@example</span></span> 4<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * const user: User = { name: "John", age: 30 }</span></span> 5<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> */</span></span> 6<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> interface</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> User</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span> 7<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> /** User's full name */</span></span> 8<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> string</span></span> 9<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> /** User's age in years */</span></span> 10<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> age</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> number</span></span> 11<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="documentation-tags" tabindex="-1">Documentation Tags <a class="header-anchor" href="#documentation-tags" aria-label="Permalink to "Documentation Tags"">â</a></h3><ul><li><code>@param</code> - Parameter descriptions</li><li><code>@returns</code> - Return value documentation</li><li><code>@example</code> - Usage examples</li><li><code>@deprecated</code> - Deprecation notices</li><li><code>@author</code> - Author information</li><li><code>@version</code> - Version information</li><li><code>@see</code> - Cross-references</li><li><code>@throws</code> - Exception documentation</li><li><code>@template</code> - Generic type documentation</li></ul><h3 id="comment-types" tabindex="-1">Comment Types <a class="header-anchor" href="#comment-types" aria-label="Permalink to "Comment Types"">â</a></h3><ul><li><strong>Block Comments</strong>: <code>/* ... */</code></li><li><strong>Single-line Comments</strong>: <code>//</code></li><li><strong>Multi-line Documentation</strong>: Proper formatting preservation</li></ul><h2 id="performance-features" tabindex="-1">Performance Features <a class="header-anchor" href="#performance-features" aria-label="Permalink to "Performance Features"">â</a></h2><h3 id="optimized-processing" tabindex="-1">Optimized Processing <a class="header-anchor" href="#optimized-processing" aria-label="Permalink to "Optimized Processing"">â</a></h3><ul><li><strong>Bun Runtime</strong>: Leverages Bun's fast JavaScript runtime</li><li><strong>TypeScript AST</strong>: Direct TypeScript compiler API usage</li><li><strong>Minimal Dependencies</strong>: Lightweight with focused functionality</li><li><strong>Efficient File I/O</strong>: Optimized file reading and writing</li></ul><h3 id="smart-analysis" tabindex="-1">Smart Analysis <a class="header-anchor" href="#smart-analysis" aria-label="Permalink to "Smart Analysis"">â</a></h3><ul><li><strong>Selective Processing</strong>: Only processes exported declarations</li><li><strong>Dependency Tracking</strong>: Tracks type dependencies and relationships</li><li><strong>Circular Reference Handling</strong>: Proper handling of circular type dependencies</li><li><strong>Tree Shaking</strong>: Removes unused type definitions</li></ul><h2 id="cli-features" tabindex="-1">CLI Features <a class="header-anchor" href="#cli-features" aria-label="Permalink to "CLI Features"">â</a></h2><h3 id="command-structure" tabindex="-1">Command Structure <a class="header-anchor" href="#command-structure" aria-label="Permalink to "Command Structure"">â</a></h3><ul><li><strong>Default Command</strong>: Simple <code>dtsx</code> for quick generation</li><li><strong>Explicit Commands</strong>: <code>dtsx generate</code> for clarity</li><li><strong>Version Command</strong>: <code>dtsx version</code> for version info</li><li><strong>Help System</strong>: Comprehensive help with examples</li></ul><h3 id="option-handling" tabindex="-1">Option Handling <a class="header-anchor" href="#option-handling" aria-label="Permalink to "Option Handling"">â</a></h3><ul><li><strong>Boolean Flags</strong>: <code>--clean</code>, <code>--verbose</code>, <code>--keep-comments</code></li><li><strong>Value Options</strong>: <code>--root</code>, <code>--outdir</code>, <code>--entrypoints</code></li><li><strong>Path Resolution</strong>: Automatic path resolution and validation</li><li><strong>Configuration Override</strong>: CLI options override config files</li></ul><h2 id="integration-features" tabindex="-1">Integration Features <a class="header-anchor" href="#integration-features" aria-label="Permalink to "Integration Features"">â</a></h2><h3 id="build-tool-integration" tabindex="-1">Build Tool Integration <a class="header-anchor" href="#build-tool-integration" aria-label="Permalink to "Build Tool Integration"">â</a></h3><ul><li><strong>Package.json Scripts</strong>: Easy integration with npm scripts</li><li><strong>
11CI/CD Support</strong>: Suitable for automated build pipelines</li><li><strong>Watch Mode</strong>: File watching capabilities (future feature)</li><li><strong>Incremental Builds</strong>: Smart rebuilding (future feature)</li></ul><h3 id="configuration-management" tabindex="-1">Configuration Management <a class="header-anchor" href="#configuration-management" aria-label="Permalink to "Configuration Management"">â</a></h3><ul><li><strong>Config Files</strong>: <code>dts.config.ts</code> and <code>dts.config.js</code> support</li><li><strong>Environment Variables</strong>: Environment-based configuration</li><li><strong>Default Values</strong>: Sensible defaults for all options</li><li><strong>Validation</strong>: Configuration validation and error reporting</li></ul><h2 id="quality-features" tabindex="-1">Quality Features <a class="header-anchor" href="#quality-features" aria-label="Permalink to "Quality Features"">â</a></h2><h3 id="type-safety" tabindex="-1">Type Safety <a class="header-anchor" href="#type-safety" aria-label="Permalink to "Type Safety"">â</a></h3><ul><li><strong>Isolated Declarations</strong>: Requires and validates isolated declarations</li><li><strong>Type Validation</strong>: Ensures type correctness in output</li><li><strong>Import Resolution</strong>: Proper import path resolution</li><li><strong>Export Tracking</strong>: Tracks all exports and their usage</li></ul><h3 id="error-handling" tabindex="-1">Error Handling <a class="header-anchor" href="#error-handling" aria-label="Permalink to "Error Handling"">â</a></h3><ul><li><strong>Graceful Failures</strong>: Continues processing on individual file errors</li><li><strong>Detailed Errors</strong>: Comprehensive error messages with context</li><li><strong>Validation</strong>: Input validation and early error detection</li><li><strong>Recovery</strong>: Attempts to recover from parsing errors</li></ul><h2 id="future-features" tabindex="-1">Future Features <a class="header-anchor" href="#future-features" aria-label="Permalink to "Future Features"">â</a></h2><h3 id="planned-enhancements" tabindex="-1">Planned Enhancements <a class="header-anchor" href="#planned-enhancements" aria-label="Permalink to "Planned Enhancements"">â</a></h3><ul><li><strong>Watch Mode</strong>: File watching for development</li><li><strong>Incremental Builds</strong>: Only rebuild changed files</li><li><strong>Plugin System</strong>: Extensible plugin architecture</li><li><strong>Custom Transformers</strong>: User-defined type transformations</li><li><strong>Bundle Analysis</strong>: Dependency analysis and optimization</li><li><strong>Source Maps</strong>: Source map generation for debugging</li></ul><h3 id="community-features" tabindex="-1">Community Features <a class="header-anchor" href="#community-features" aria-label="Permalink to "Community Features"">â</a></h3><ul><li><strong>VS Code Extension</strong>: Editor integration</li><li><strong>Language Server</strong>: Enhanced IDE support</li><li><strong>Documentation Generation</strong>: Automatic docs from types</li><li><strong>Type Checking</strong>: Enhanced type validation</li></ul>`,52)]))}const h=t(o,[["render",r]]);export{g as __pageData,h as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.