PageSourceSearch

https://dtsx.netlify.app/assets/advanced_index.md.C_lBDVSx.js

js dtsx.netlify.app collected 2026-10-03 10:40:26 UTC 18,114 bytes, 39 lines download raw bytes

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 &quot;Advanced Topics&quot;">​</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 &quot;Type Processing&quot;">​</a></h2><p>Learn about dtsx&#39;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 &amp; Optimization <a class="header-anchor" href="#performance-optimization" aria-label="Permalink to &quot;Performance &amp; Optimization&quot;">​</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&#39;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 &amp; Automation <a class="header-anchor" href="#integration-automation" aria-label="Permalink to &quot;Integration &amp; Automation&quot;">​</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 &amp; Debugging <a class="header-anchor" href="#troubleshooting-debugging" aria-label="Permalink to &quot;Troubleshooting &amp; Debugging&quot;">​</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 &quot;Configuration Patterns&quot;">​</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 &quot;Multi-Package Monorepos&quot;">​</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;">    &#39;packages/*/src/index.ts&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
5<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">    &#39;packages/*/src/types.ts&#39;</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;">&#39;mirror&#39;</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 &quot;Selective Type Generation&quot;">​</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;">    &#39;src/public-api/**/*.ts&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
13<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">    &#39;!src/internal/**/*.ts&#39;</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 &quot;Custom Output Structures&quot;">​</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;">&#39;flat&#39;</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;">&#39;./types&#39;</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 &quot;Best Practices&quot;">​</a></h2><h3 id="type-design" tabindex="-1">Type Design <a class="header-anchor" href="#type-design" aria-label="Permalink to &quot;Type Design&quot;">​</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 &quot;Project Structure&quot;">​</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 &quot;Performance&quot;">​</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 &quot;Documentation&quot;">​</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 &quot;Advanced Use Cases&quot;">​</a></h2><h3 id="library-development" tabindex="-1">Library Development <a class="header-anchor" href="#library-development" aria-label="Permalink to &quot;Library Development&quot;">​</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;"> &#39;./types&#39;</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 &quot;API Client Generation&quot;">​</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;">&lt;</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;">&gt; {</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 &quot;Plugin Systems&quot;">​</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;">&lt;</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;">&lt;</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;">&gt;&gt; {</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;">&lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">void</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</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.