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

export const function is declared but its value is never read #2717

Open
Jojoshua opened this issue Mar 18, 2025 · 0 comments
Open

export const function is declared but its value is never read #2717

Jojoshua opened this issue Mar 18, 2025 · 0 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@Jojoshua
Copy link
Contributor

Jojoshua commented Mar 18, 2025

Describe the bug

I've highlighted the important parts to explain the issue but basically trying to add type definition to an exported const function throws a ts error. This is similar to #2268 but doesn't involve bindings.
 
Image

Reproduction

app.ts


export type CommonFunction = () => void;

App.svelte

<script lang="ts">
    import type { CommonFunction } from "$lib/app";

    export interface Props {
      name?: string;
    }

    let { name = "world" }: Props = $props();

    export const MyFunction2: CommonFunction = () =>{
      console.log("Hello from MyFunction!");
    }

  </script>

Expected behaviour

No errors are thrown for any exports

System Info

  • OS: [e.g. Windows]
  • IDE: [e.g. VSCode, Atom]

Which package is the issue about?

No response

Additional Information, eg. Screenshots

Note adding //@ts-ignore silences the error, everything does work but would rather not ignore all these errors

@Jojoshua Jojoshua added the bug Something isn't working label Mar 18, 2025
dummdidumm added a commit that referenced this issue Mar 19, 2025
Ensure they are read as part of exporting the types

#2717
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Mar 19, 2025
dummdidumm added a commit that referenced this issue Mar 19, 2025
Ensure they are read as part of exporting the types

#2717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

2 participants