unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.66k stars 131 forks source link

Add tsconfig instructions to docs #280

Closed khari998 closed 1 year ago

khari998 commented 1 year ago

Clear and concise description of the problem

In order to get my IDE to stop yelling at me over not being able to find the types for the icons, I had to add the types to my tsconfig like so :

"compilerOptions": {
        ...,
        "types": ["unplugin-icons/types/svelte"]
    }
khari998 commented 1 year ago

Edit:

There was separate step in the docs that I missed for SvelteKit:

For SvelteKit, in the src/app.d.ts file:

/// <reference types="@sveltejs/kit" />
/// <reference types="unplugin-icons/types/svelte" />

This also fixes the problem and the tsconfig does not need to be modified

SaintPepsi commented 3 months ago

Thanks for posting this. I didn't even think to look at the app.d.ts which has the example: app.d.ts

You can add import 'unplugin-icons/types/svelte' in your /src/app.d.ts