Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/svelte2tsx/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export interface EmitDtsConfig {
* Example: `require.resolve('svelte2tsx/svelte-shims.d.ts')`
*/
svelteShimsPath: string;
/**
* Additional file paths that need to be present when doing the dts emit.
* Example: `[require.resolve('svelte2tsx/svelte-jsx.d.ts')]` for the Svelte HTML ambient type definitions
*/
additionalPaths?: string[];
/**
* If you want to emit types only for part of your project,
* then set this to the folder for which the types should be emitted.
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte2tsx/src/emitDts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { svelte2tsx } from './svelte2tsx';
export interface EmitDtsConfig {
declarationDir: string;
svelteShimsPath: string;
additionalPaths?: string[];
libRoot?: string;
}

Expand Down Expand Up @@ -72,6 +73,7 @@ function loadTsconfig(config: EmitDtsConfig, svelteMap: SvelteMap) {
// Add ambient functions so TS knows how to resolve its invocations in the
// code output of svelte2tsx.
filenames.push(config.svelteShimsPath);
filenames.push(...(config.additionalPaths || []));

return {
options: {
Expand Down