question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

Thanks for this loader! I’m using it in Vue 3 with TypeScript, and I’m getting the following Vetur warning in VS Code for each SVG in the line that says something like components: { MyLogo }:

No overload matches this call.
  The last overload gave the following error.
    Type 'string' is not assignable to type 'Component<any, any, any, Record<string, ComputedGetter<any> | WritableComputedOptions<any>>, MethodOptions>'

Is there a way to inform TypeScript that the result of that import { MyLogo } from "mylogo.svg" will, in fact, be a Component, not a string?

Everything still works fine, it’s just a red-squiggly issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
gabrielchiquinicommented, Mar 15, 2021

hi, maybe vite/client types is conflicting with your declaration in Vite 2. I’m getting this error


10   export default src
                    ~~~

  node_modules/vite/client.d.ts:130:18
    130   export default src
                         ~~~
    'src' was also declared here.

node_modules/vite/client.d.ts:130:18 - error TS2300: Duplicate identifier 'src'.

130   export default src
                     ~~~

  node_modules/vite-svg-loader/index.d.ts:10:18
    10   export default src
                        ~~~
    'src' was also declared here.


Found 2 errors.

I don’t know if you can override, but Vite 2 provide types for svg. Doc: https://vitejs.dev/guide/features.html#client-types

1reaction
jpkleemanscommented, Jun 18, 2021

This is fixed in version 2.0.3. You’ll need to use the ?component param when importing your svg files in a TypeScript project:

import MyIcon from './my-icon.svg?component'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Type I and type II errors - Wikipedia
The type I error rate is the probability of rejecting the null hypothesis given that it is true. · The rate of the...
Read more >
Type Errors - learn how to fix these - Codecademy
Type Errors : these show up when a value is not the expected type. In the sections below you will find the different...
Read more >
How to Fix TypeError Exceptions in Python - Rollbar
The Python TypeError is an exception that occurs when the data type of an object in an operation is inappropriate.
Read more >
ERROR.TYPE function - Microsoft Support
This article describes the formula syntax and usage of the ERROR.TYPE function in Microsoft Excel. Description. Returns a number corresponding to one of...
Read more >
Type I & Type II Errors | Differences, Examples, Visualizations
In statistics, a Type I error is a false positive conclusion, while a Type II error is a false negative conclusion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found