Skip to content

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

@DetachHead

Description

@DetachHead
<!-- 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions