Unused export inside exported namespace not reported
I have created a workspace to replicate this issue:
I have a namespace Parent with 2 exports Child1 and Child2. While Child1 is used in App.tsx. Child2 is unsed. Knip is not reporting Child2 as unused.
I have added issue types nsExports and nsTypes while running knip. Still not getting the unused Export
Unfortunately namespaces are not supported yet. Just looked into it and did some preliminary work, but it's not trivial.
@webpro if namespaces are not supported why is there an issue type nsExport with description Namespace with export is referenced, but not export itself
Good question, I need to document this better.
There's two different types of namespaces here:
- The
import * as NS from '..'whereNSis the namespace, which is whatnsExportsand https://knip.dev/guides/namespace-imports is about. - The
namespacefeature of TypeScript (https://www.typescriptlang.org/docs/handbook/namespaces.html) which is not supported yet by Knip.
Is it ok if I open a PR for this, we are loving knip at work and will like to contribute.
Absolutely! Let me know if you need any assistance.
Closing this due to inactivity (also namespaces are going out of fashion).