VScode produces error that's about Svelte, but mentions JSX!
See original GitHub issueDescribe the bug
import Chart
JSX element class does not support attributes because it does not have a '$$prop_def' property.ts(2607)
Type definitions are missing for this Svelte Component. It needs a class definition with at least the property '$$prop_def' which should contain a map of input property definitions.
Example:
class ComponentName { $$prop_def: { propertyName: string; } }
'Chart' cannot be used as a JSX component.
Its instance type 'Base' is not a valid JSX element.
Property '$$prop_def' is missing in type 'Base' but required in type 'ElementClass'.
I understand this error (I need to provide TypeScript typings for the component) but the JSX element
and JSX component
is confusing - I’m not using React or JSX!
To Reproduce Minimal .svelte file:
<script lang="ts">
export let name: string;
import Chart from 'svelte-frappe-charts';
const data = {
labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
datasets: [
{
name: "Dataset 1",
values: [18, 40, 30, 35, 8, 52, 17, -4],
chartType: 'bar'
},
{
name: "Dataset 2",
values: [30, 50, -10, 15, 18, 32, 27, 14],
chartType: 'line'
}
]
}
</script>
<main>
<Chart data={data} type="axis-mixed" />
</main>
Expected behavior A message that mentions Svelte, not some old framework!
System (please complete the following information):
- OS: Windows 10 20.04
- IDE: VScode
- Plugin/Package: Svelte for VScode v102.8.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
VSCode Error on <script> tag in .svelte file - Stack Overflow
I'm having a really odd visual issue in VSCode when working on a Svelte project. All of my files that end in .svelte...
Read more >Getting started with Svelte - Learn web development | MDN
Svelte is a compiler that generates minimal and highly optimized JavaScript code from our sources; you'll need a terminal with node + npm ......
Read more >Testing a Svelte app with Vitest - LogRocket Blog
Vitest has become the first choice dev tool for Svelte. Learn about its features and integrations and how it compares to Jest.
Read more >Svelte generates a LOT of JS output code. How is it not adding ...
Svelte docs mentions heavily that they are a compiler and don't have runtime cost but all the the compiled output which is svelte...
Read more >Comapring React, Angular, Vue, and Svelte - Accelebrate
But it lacks important features that I'd have prioritized. ... When I added TypeScript, Svelte produced errors immediately.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still running into this issue with the latest version of svelte and svelte-vscode.
Ah thanks for explaining @dummdidumm !