Skip to content

knip does not detect type imports that happen in svelte files #410

@thenbe

Description

@thenbe

In the current svelte compiler recipe, we compile a svelte file straight to javascript, then pass the javascript to knip. As a result, knip never sees type imports that happen in svelte files. For example:

// myfile.ts
export type Foo = any
export type Bar = any
export const baz = ''
<script lang='ts'>
  import type { Foo } from './myfile'
  import { type Bar } from './myfile'
  import { baz } from './myfile'
</script>

Here, knip will report both Foo and Bar as "unused type exports" (assuming no other typescript file also imports them).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions