-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript support? #55
Comments
No idea :| @kevinmarrec Do you have a clue by any chance? |
@manniL Yes I have ! @webcoderkz It needs to be a With content : declare module '*.svg' {
const content: any
export default content
} It makes TypeScript aware of what type should resolve a SVG file, fixing errors when importing PS : I will add a note in new TypeScript docs about non-TS/JS imports |
@kevinmarrec thanks, i've added types/svg-shims.d.ts with contents you wrote, but typescript still complains. My tsconfig.json file:
|
@webcoderkz Could you provide a github repository directly, by any chance ? I will be able to take a look. |
i will upload it in 30 mins. |
@webcoderkz Doesn't seem to be the right one, isn't it ? I don't have errors and can't find |
It's wrong code i've uploaded, lol, sorry. Anyway, i just noticed, if i declare modules as you said:
Then it works, no errors, but if i use inline method: |
@webcoderkz Well then only workaround/solution shoud be : const logo = require("./logo.svg") as string |
You mean |
@webcoderkz No cause it's not syntax valid with |
@webcoderkz You have to declare the declare module '*.svg?inline' {
const content: any
export default content
}
declare module '*.svg' {
const content: any
export default content
} It works fine for me :) |
I'm using nuxt with typescript (nuxt-property-decorator), when import svg:
I'm getting error:
Cannot find module '@/assets/svg/logo.svg'.Vetur(2307)
The text was updated successfully, but these errors were encountered: