tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

@ts-ignore not supported in <script> tag #172

Closed aquinan closed 3 years ago

aquinan commented 3 years ago

When a module is imported in a svelte component's script tag that does not have type definitions, @ts-ignore does not suppress the context error. Also the context menu for the error in WebStorm does not suggest using @ts-ignore.

<script lang="ts">
    ...
    // @ts-ignore
    import { Form } from 'svelte-forms-lib';
   ...
</script>
tomblachut commented 3 years ago

Hi! Thanks for reporting.

@anstarovoyt can this be fixed without implementing LSP?

@aquinan as per your original problem you should write missing declarations instead of escaping from typechecker. It works across your whole project that way..

Below one-liner will suffice and make everything in a module typed as any.

declare module "svelte-forms-lib";

more here https://justintimecoder.com/how-to-polyfil-missing-types-in-typescript/

anstarovoyt commented 3 years ago

it must be done on the IDE side. See https://youtrack.jetbrains.com/issue/WEB-48109

anstarovoyt commented 3 years ago

WEB-48109 will be fixed in 2020.3