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

Types: Exported functions and properties of a component are not visible on the components type #356

Closed
AlexAegis opened this issue Jul 25, 2020 · 1 comment

Comments

@AlexAegis
Copy link

Exported properties and functions should appear on the components type

app.svelte

<script lang="ts">
  import Foo from './foo.svelte';
  import { onMount } from 'svelte';

  const myFoo!: Foo;
  onMount(() => {
    console.log(myFoo.foo); // Property 'foo' does not exist on type 'Foo__SvelteComponent_'.ts(2339)
    console.log(myFoo.bar); // Property 'bar' does not exist on type 'Foo__SvelteComponent_'.ts(2339)
    console.log(myFoo.fooBar); // Property 'fooBar' does not exist on type 'Foo__SvelteComponent_'.ts(2339)
    // But all three outputs the correct results
  });
</script>

<Foo bind:this={myFoo} />

foo.svelte

<script lang="ts">
  export const foo = 10;
  export function bar() {};
  export const fooBar = () => {};
</script>
@jasonlyu123
Copy link
Member

Duplicate of #307

@jasonlyu123 jasonlyu123 marked this as a duplicate of #307 Jul 25, 2020
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

2 participants