Home > database >  Globally Include Types in SvelteKit Project
Globally Include Types in SvelteKit Project

Time:06-26

SvelteKit v1.0.0-next.354

In all my stores, components, and APIs, I have to manually import my types in order to use them in order to prevent TypeScript errors in VS Code:

import type { MyType } from '$lib/types`

I tried putting my class inside app.d.ts, but that didn't work.

declare namespace App{
  export class Aircraft{
    ...
  }
}

This gets pretty cumbersome to do across a project that is getting quite large with dozens of files.

Is there some way to globally include all my types in one place so that they are available in any file across my project? I'm very new to TypeScript and am not sure how this works.

  • Related