Skip to content
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

Svelte for VS Code reports <svelte:window on:resize> as error #348

Closed
nilsroehrig opened this issue Jul 24, 2020 · 2 comments · Fixed by #349
Closed

Svelte for VS Code reports <svelte:window on:resize> as error #348

nilsroehrig opened this issue Jul 24, 2020 · 2 comments · Fixed by #349
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@nilsroehrig
Copy link

Describe the bug

Given the following Svelte component written in TypeScript:

<script lang="ts">
  export let name: string;
</script>

<svelte:window on:resize={() => console.log('resize')} />

<h1>Hello {name}!</h1>

The on:resize part is marked as not-assignable by TS due to (supposedly?) missing property onresize on used type for that expression:

Type '{ onresize: () => void; }' is not assignable to type 'HTMLProps<Window> & SvelteWindowProps'.
  Property 'onresize' does not exist on type 'HTMLProps<Window> & SvelteWindowProps'.ts(2322)

To Reproduce
Steps to reproduce the behavior:

  1. Setup new svelte / TS project as per instructions:
npx degit sveltejs/template svelte-typescript-app
cd svelte-typescript-app
node scripts/setupTypeScript.js
  1. Open project in VS Code with 'Svelte for VS Code' extension installed and enabled
  2. Edit App.svelte to include <svelte:window on:resize={() => console.log('resize')} />
  3. Watch a red squiggly line appearing underneath with above mentioned error

Expected behavior
No error is appearing. The resize handler is accepted just as it is.

Screenshots
svelte_vs_code_error

System (please complete the following information):

  • OS: Linux (elementary OS based on Ubuntu 18.04)
  • IDE: VSCode
  • Plugin/Package: "Svelte for VSCode", svelte-language-server, probably even type information in Svelte itself

Additional context
First appeared to me while tinkering with Typescript support in an existing Svelte project, reproduced in clean Svelte / TS project as described above.

@nilsroehrig nilsroehrig added the bug Something isn't working label Jul 24, 2020
@jasonlyu123 jasonlyu123 reopened this Jul 25, 2020
@jasonlyu123 jasonlyu123 added the Fixed Fixed in master branch. Pending production release. label Jul 25, 2020
@nilsroehrig
Copy link
Author

Thank's for the quick response, great work!

@g-chandran
Copy link

Now on:webkitfullscreenchange also seems to be missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants