Skip to content

Types for built-in elements getting overriden #228

@joelmukuthu

Description

@joelmukuthu

Describe the bug
If one installs some @types/* npm module that somehow overrides React types then type-checking gets messed up. I can imagine why this happens, but it would be nice if it could be fixed somehow. In my case, I'm using storybook (with Svelte) but it installs a bunch of @types/* modules which somehow mess up the types that the language server users. I haven't identified which of the types modules is the culprit. But ideally the language server types should trump other types.

To Reproduce
Steps to reproduce the behavior:

  1. Install the @storybook/addon-knobs npm module
  2. Trigger TS types to be loaded somehow, e.g. by importing the module
  3. Simple HTML now triggers type errors

Example code that triggers the error:

<script lang="typescript">
  import * as foo from '@storybook/addon-knobs';
</script>

<div>
  <p></p>
</div>

Expected behavior
That the HTML would not trigger an error.

Screenshots
image

System (please complete the following information):

  • OS: Linux
  • IDE: VSCode
  • Plugin/Package: "Svelte Beta", svelte-language-server, svelte-check

Additional context
svelte-check also triggers the same errors that show up in the IDE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions