-
-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Prerequisites
- I'm using the latest version
- I've read the relevant documentation
- I've searched for existing issues
- I've checked the list of known issues
- I've read the issue reproduction guide
Reproduction url
https://github.com/Jym77/knip-namespace-overload
Reproduction access
- I've made sure the reproduction is publicly accessible
Description of the issue
Sorry, one more for the namespaces 😅
foo.ts:
/** @public */
export function hello(x: number): number
/** @public */
export function hello(x: string): number
export function hello(x: number | string): number {
return 1;
}
export namespace Foo {
/** @public */
export function hello(x: number): number
/** @public */
export function hello(x: string): number
export function hello(x: number | string): number {
return 1;
}
}index.ts
import { Foo } from './foo.ts'So, none of the functions are used, but the @public tag tells knip that it's OK. Running knip results in:
Unused exported namespace members (1)
hello Foo foo.ts:18:19
which reports the implementation of Foo.hello (not its overloads, who are @public). Adding a @public tag to the implementation removes the flagging.
Where it is weird, is that the (top-level) hello is exactly the same code, and there the implementation without the @public tag is not reported.
I think the top-level behaviour makes sense: only the overloads are really making it to the API of the package, the implementation signature is hidden for users. (and different overloads could actually have different release tags).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working