language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Type not inferred for `export {...}` (works with `export const ...`)

Open giacomoran opened this issue 3 years ago • 0 comments

Describe the bug

Hi!

Given the component below, a bind:this will return a component instance where some read-only exports are typed and some are not:

<script lang="ts">
  const foo = "Vittorio Alfieri";
  export {foo};            // Type not inferred (any)
  export const foo_ = foo; // ✔ inferred (string)
  export const bar = 41;   // ✔ inferred (string)
</script>

The export {...} syntax would allow our code to be cleaner and more concise.

Reproduction

Full repro (see App.svelte and lib/Name.svelte) : https://github.com/GiacomoRandazzo/svelte-bindthis-types

Logs

No response

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 2.78 GB / 31.24 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.13.2 - ~/.asdf/installs/nodejs/16.13.2/bin/node
    Yarn: 1.22.15 - ~/.asdf/installs/nodejs/16.13.2/bin/yarn
    npm: 8.13.2 - ~/.asdf/installs/nodejs/16.13.2/.npm/bin/npm
  Browsers:
    Brave Browser: 86.1.16.68
    Chrome: 104.0.5112.101
    Chromium: 105.0.5195.102
    Firefox: 104.0
  npmPackages:
    svelte: ^3.49.0 => 3.50.1

Severity

annoyance

giacomoran avatar Sep 15 '22 17:09 giacomoran