1import{_ as s,i as a,o as e,ak as n}from"./chunks/framework.Da91f1N-.js";const c=JSON.parse('{"title":"Advanced Topics","description":"","frontmatter":{},"headers":[],"relativePath":"advanced/index.md","filePath":"advanced/index.md"}'),t={name:"advanced/index.md"};function l(p,i,r,h,o,k){return e(),a("div",null,i[0]||(i[0]=[n(`<h1 id="advanced-topics" tabindex="-1">Advanced Topics <a class="header-anchor" href="#advanced-topics" aria-label="Permalink to "Advanced Topics"">â</a></h1><p>This section covers advanced topics and techniques for using dtsx effectively in complex scenarios.</p><h2 id="type-processing" tabindex="-1">Type Processing <a class="header-anchor" href="#type-processing" aria-label="Permalink to "Type Processing"">â</a></h2><p>Learn about dtsx's advanced type processing capabilities:</p><ul><li><strong><a href="./type-processing">Type Processing</a></strong>: Deep dive into how dtsx processes TypeScript types</li><li><strong>Complex Type Inference</strong>: Handling nested, recursive, and conditional types</li><li><strong>Type Relationship Tracking</strong>: Maintaining type dependencies across files</li><li><strong>Declaration Extraction</strong>: Understanding the AST-based extraction process</li><li><strong>Comment Preservation</strong>: Advanced comment handling and formatting</li></ul><h2 id="performance-optimization" tabindex="-1">Performance & Optimization <a class="header-anchor" href="#performance-optimization" aria-label="Permalink to "Performance & Optimization"">â</a></h2><p>Optimize dtsx for large codebases and complex projects:</p><ul><li><strong><a href="./performance">Performance</a></strong>: Performance optimization strategies and best practices</li><li><strong>Import Optimization</strong>: Advanced techniques for optimizing import statements</li><li><strong>Memory Management</strong>: Handling large codebases efficiently with Bun's runtime</li><li><strong>File Processing</strong>: Optimizing multi-file processing workflows</li><li><strong>Output Structure</strong>: Choosing the right output structure for your needs</li></ul><h2 id="integration-automation" tabindex="-1">Integration & Automation <a class="header-anchor" href="#integration-automation" aria-label="Permalink to "Integration & Automation"">â</a></h2><p>Integrate dtsx into your development workflow:</p><ul><li><strong><a href="./integration">Integration</a></strong>: Build system and CI/CD integration patterns</li><li><strong>Build Tool Integration</strong>: Webpack, Vite, Rollup, and other bundler integration</li><li><strong>CI/CD Pipelines</strong>: Automated declaration generation in continuous integration</li><li><strong>Package.json Scripts</strong>: Effective npm script configurations</li><li><strong>Development Workflows</strong>: Hot reloading and watch mode strategies</li></ul><h2 id="troubleshooting-debugging" tabindex="-1">Troubleshooting & Debugging <a class="header-anchor" href="#troubleshooting-debugging" aria-label="Permalink to "Troubleshooting & Debugging"">â</a></h2><p>Solve common issues and debug complex scenarios:</p><ul><li><strong><a href="./troubleshooting">Troubleshooting</a></strong>: Common issues and their solutions</li><li><strong>TypeScript Configuration</strong>: Isolated declarations and tsconfig.json setup</li><li><strong>Type Resolution</strong>: Handling complex type resolution scenarios</li><li><strong>Import/Export Issues</strong>: Debugging import and export problems</li><li><strong>Performance Debugging</strong>: Identifying and fixing performance bottlenecks</li></ul><h2 id="configuration-patterns" tabindex="-1">Configuration Patterns <a class="header-anchor" href="#configuration-patterns" aria-label="Permalink to "Configuration Patterns"">â</a></h2><p>Advanced configuration techniques:</p><h3 id="multi-package-monorepos" tabindex="-1">Multi-Package Monorepos <a class="header-anchor" href="#multi-package-monorepos" aria-label="Permalink to "Multi-Package Monorepos"">â</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;">// dts.config.ts</span></span> 2<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span> 3<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> entrypoints: [</span></span> 4<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'packages/*/src/index.ts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span> 5<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'packages/*/src/types.ts'</span></span> 6<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span> 7<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> outputStructure: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'mirror'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span> 8<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> clean: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span></span> 9<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="selective-type-generation" tabindex="-1">Selective Type Generation <a class="header-anchor" href="#selective-type-generation" aria-label="Permalink to "Selective Type Generation"">â</a></h3><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span><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;">// Generate only specific modules</span></span> 10<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span> 11<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> entrypoints: [</span></span> 12<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'src/public-api/**/*.ts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span> 13<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '!src/internal/**/*.ts'</span></span> 14<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span> 15<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="custom-output-structures" tabindex="-1">Custom Output Structures <a class="header-anchor" href="#custom-output-structures" aria-label="Permalink to "Custom Output Structures"">â</a></h3><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span><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;">// Flat structure for libraries</span></span> 16<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span> 17<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> outputStructure: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'flat'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span> 18<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> outdir: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'./types'</span></span> 19<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="best-practices" tabindex="-1">Best Practices <a class="header-anchor" href="#best-practices" aria-label="Permalink to "Best Practices"">â</a></h2><h3 id="type-design" tabindex="-1">Type Design <a class="header-anchor" href="#type-design" aria-label="Permalink to "Type Design"">â</a></h3><ul><li>Use explicit type annotations for public APIs</li><li>Leverage JSDoc comments for comprehensive documentation</li><li>Design types with isolated declarations in mind</li><li>Avoid complex type computations in public interfaces</li></ul><h3 id="project-structure" tabindex="-1">Project Structure <a class="header-anchor" href="#project-structure" aria-label="Permalink to "Project Structure"">â</a></h3><ul><li>Organize types in dedicated files when appropriate</li><li>Use barrel exports for clean public APIs</li><li>Separate internal types from public interfaces</li><li>Maintain consistent naming conventions</li></ul><h3 id="performance" tabindex="-1">Performance <a class="header-anchor" href="#performance" aria-label="Permalink to "Performance"">â</a></h3><ul><li>Use type-only imports when possible</li><li>Minimize circular dependencies</li><li>Consider output structure impact on bundle size</li><li>Enable verbose logging only for debugging</li></ul><h3 id="documentation" tabindex="-1">Documentation <a class="header-anchor" href="#documentation" aria-label="Permalink to "Documentation"">â</a></h3><ul><li>Include comprehensive JSDoc comments</li><li>Use <code>@example</code> tags for usage examples</li><li>Document complex type relationships</li><li>Maintain up-to-date type documentation</li></ul><h2 id="advanced-use-cases" tabindex="-1">Advanced Use Cases <a class="header-anchor" href="#advanced-use-cases" aria-label="Permalink to "Advanced Use Cases"">â</a></h2><h3 id="library-development" tabindex="-1">Library Development <a class="header-anchor" href="#library-development" aria-label="Permalink to "Library Development"">â</a></h3><p>Creating type-safe libraries with comprehensive declaration files:</p><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span>
19<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;">// src/index.ts</span></span> 20<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/**</span></span> 21<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * Main library interface</span></span> 22<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">@example</span></span> 23<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * const lib = new MyLibrary({ config: true })</span></span> 24<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> */</span></span> 25<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> MyLibrary</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span> 26<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> constructor</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">options</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> LibraryOptions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {}</span></span> 27<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span> 28<span class="line"></span> 29<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { LibraryOptions } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> './types'</span></span></code></pre></div><h3 id="api-client-generation" tabindex="-1">API Client Generation <a class="header-anchor" href="#api-client-generation" aria-label="Permalink to "API Client Generation"">â</a></h3><p>Generating types for API clients and SDKs:</p><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span><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;">// Generate types for REST API responses</span></span> 30<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;"> ApiResponse</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> unknown</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> {</span></span> 31<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> data</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> T</span></span> 32<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> status</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> number</span></span> 33<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> string</span></span> 34<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="plugin-systems" tabindex="-1">Plugin Systems <a class="header-anchor" href="#plugin-systems" aria-label="Permalink to "Plugin Systems"">â</a></h3><p>Creating extensible plugin architectures with proper typing:</p><div class="language-typescript vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">typescript</span>
34<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;">// Plugin interface with proper type constraints</span></span> 35<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;"> Plugin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">TConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> Record</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">unknown</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>> {</span></span> 36<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> 37<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> TConfig</span></span> 38<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> Promise</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">void</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span> 39<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div>`,41)]))}const g=s(t,[["render",l]]);export{c as __pageData,g 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.