language-tools: Cannot specify tabindex with `tabindex="-1"` when working with typescript
Describe the bug
Cannot specify tabindex with tabindex="-1"
when working with typescript
I have to use tabindex={-1}
To Reproduce
Create a typescript project with npx degit sveltejs/template && node scripts/setupNode.js
REplace you App.svelte with:
<script lang="ts">
export let name: string
let headingEl
</script>
<main>
<h1 bind:this={headingEl} tabindex="-1">Hello {name}!</h1>
<p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
</main>
and then
$ npm run validate
> svelte-app@1.0.0 validate /home/sas/devel/apps/mdn/mdn-svelte-tutorial/08-typescript-support
> svelte-check
Loading svelte-check in workspace: /home/sas/devel/apps/mdn/mdn-svelte-tutorial/08-typescript-support
Getting Svelte diagnostics...
====================================
/home/sas/devel/apps/mdn/mdn-svelte-tutorial/08-typescript-support/src/components/TodosStatus.svelte:25:45
Error: Type 'string' is not assignable to type 'number'. (ts)
eadingEl} tabindex="-1">{com
System (please complete the following information):
- OS: Ubuntu 18.04
- IDE: vscode
- Plugin/Package: [e.g.
svelte-check
]
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- (feat) transform number attrs #366 When 1. an attribute expects input of number only 2. its value is of type number 3. attribute is written as string then transform it Example: `<div tabindex="1"><... — committed to dummdidumm/language-tools by deleted user 4 years ago
- (feat) transform number attrs (#428) #366 When 1. an attribute expects input of number only 2. its value is of type number 3. attribute is written as string then transform it Example: `<div... — committed to sveltejs/language-tools by dummdidumm 4 years ago
You are not seeing it in VSCode yet because it’s not released yet.
svelte-check
gets it as part of the nightly builds, the VSCode extension is published “manually”. That will happen in a couple of days. If you don’t want to wait and are ok with some unstable builds, you can also use the Nightly Build of the extension.Great! I’ve just upgraded to svelte-check@1.0.9 and it works ok!
But I keep getting the error from vscode:
I tried Restarting Svelte Language server, and also restarting vscode itsefl, also issued an
npm update
, these are the libs I have:Is there some way to also apply this fix to vscode?
BTW, thanks a lot for your effort, it’s really awesome the work you are all doing, most issues are solved in a couple of hours, I bet there is no commercial support that gets even close to this response!