Skip to content

Component generic type inference issue #945

@ryu-man

Description

@ryu-man

Describe the bug
Svelte extension is unable to infer the generic type of a component (in .svelte file) from props

To Reproduce
Steps to reproduce the behavior:

A.svelte

<script>
  export let prop
</script>

A.svelte.d.ts
export default class A<T> extends SvelteComponentTyped<{prop:T}>

App.svelte

<script>
    import A from './A.svelte'
</script>

// type inference work for prop but not for the component
<A  prop={3} />

Expected behavior
Component declared with generics should infer the types from props

Screenshots
If applicable, add screenshots to help explain your problem.
Untitled3
Untitled

Type inference works fine when the component instantiated in a js file
Untitled1

System (please complete the following information):

  • OS: Windows
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.feature requestNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions