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

@typescript-eslint/no-unsafe-argument/no-unsafe-return false positive in svelte code but not in script tag #197

Open
DetachHead opened this issue Nov 30, 2022 · 1 comment

Comments

@DetachHead
Copy link

<!-- asdf.svelte -->
<script lang="ts">
    export let onChange: (value: any) => void
</script>
<!-- main.svelte -->
<script lang="ts" context="module">
    declare const value: any
</script>

<script lang="ts">
    import Asdf from './asdf.svelte'

    let foo: unknown
    foo = value // no errors
</script>

<!--
    Unsafe return of an `any` typed value. (@typescript-eslint/no-unsafe-return)
    Unsafe assignment of an `any` value. (@typescript-eslint/no-unsafe-assignment)
-->
<Asdf onChange={(value) => (foo = value)} />

since it's valid to assign any to unknown, this should not be an error. typescript-eslint playground

@DetachHead
Copy link
Author

this issue doesn't occur in eslint-plugin-svelte which seems to be more actively maintained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant