svelte-icons icon indicating copy to clipboard operation
svelte-icons copied to clipboard

TS missing declaration files

Open vlrevolution opened this issue 3 years ago • 8 comments

Anybody got any advice how to fix this? I can't figure it out:

module "/home/dreamer/code/primate_dao/node_modules/svelte-icons/io/IoIosBuild.svelte" Could not find a declaration file for module 'svelte-icons/io/IoIosBuild.svelte'.

vlrevolution avatar Jul 02 '22 19:07 vlrevolution

This is indeed quite unfortunate, because all the files in which I'm trying to use an icon now show as erroneous/red in VSCode:

image

Even if TS declaration files cannot be provided, is there a way to silence these issues?

bluenote10 avatar Feb 14 '23 21:02 bluenote10

In sveltekit, i added this to src/app.d.ts

declare module 'svelte-icons/**/*.svelte' {
  import { SvelteComponentTyped } from 'svelte';
  export default class extends SvelteComponentTyped<{}, {}, {}> {}
}

Which seems to work

ericwooley avatar Apr 16 '23 16:04 ericwooley

In sveltekit, i added this to src/app.d.ts

declare module 'svelte-icons/**/*.svelte' {
  import { SvelteComponentTyped } from 'svelte';
  export default class extends SvelteComponentTyped<{}, {}, {}> {}
}

Which seems to work

Are you sure? For me this has no effect

vlrevolution avatar May 17 '23 16:05 vlrevolution

In sveltekit, i added this to src/app.d.ts

declare module 'svelte-icons/**/*.svelte' {
  import { SvelteComponentTyped } from 'svelte';
  export default class extends SvelteComponentTyped<{}, {}, {}> {}
}

Which seems to work

Are you sure? For me this has no effect

Same

rushkii avatar May 29 '23 01:05 rushkii

I think this repo is not maintained anymore?

rushkii avatar May 29 '23 01:05 rushkii

Same error for me. Added the declared module to src/app.d.ts but it doesn't change anything.

Der-Penz avatar Jul 20 '23 15:07 Der-Penz

It worked for my by declaring each index file of ever folder like this:

declare module 'svelte-icons/**/index.js'{
	import { SvelteComponentTyped } from 'svelte';
	export default class extends SvelteComponentTyped<{}, {}, {}> {}
}

Der-Penz avatar Jul 21 '23 16:07 Der-Penz

seems that the declare module does not understand the /**/ all subdirectories part. declare module 'svelte-icons/fa/*.svelte' { import { SvelteComponentTyped } from 'svelte'; export default class extends SvelteComponentTyped<{}> {} } I gave the folder name I needed for font awesome fonts and it worked.

luisgarciaalanis avatar Nov 02 '23 02:11 luisgarciaalanis