title: How to make Svelte aware of custom *.d.ts files?
body: <p>I want to import some <code>*.txt</code> file as a string into a svelte component. The following typescript code raises no warning in VS Code:</p>
  <pre><code>// global.d.ts
  declare module &quot;*.txt&quot; {
      const content: string;
      export default content;
  }
  </code></pre>
  <pre><code>// test.ts
  import txt from &quot;./test.txt&quot;;
  </code></pre>
  <p>However, if I try to import the same text file into a Svelte component (while <code>global.d.ts</code> still exists):</p>
  <pre><code>// Test.svelte
  &lt;script type=&quot;typescript&quot;&gt;
      import txt from &quot;./test.txt&quot;;
  &lt;/script&gt;
  </code></pre>
  <p>, VS Code will complain <code>Cannot find module './test.txt' or its corresponding type declarations. ts(2307)</code>. So how to properly tell Svelte about the declarations inside <code>global.d.ts</code>?</p>