Skip to content

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

Closed
@Jojoshua

Description

@Jojoshua

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions