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.

VScode produces error that's about Svelte, but mentions JSX!

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
pheutercommented, Sep 24, 2021

Still running into this issue with the latest version of svelte and svelte-vscode.

2reactions
mikemaccanacommented, Jan 13, 2021

Ah thanks for explaining @dummdidumm !

Read more comments on GitHub >

github_iconTop 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 >

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