As title. I was trying to find the exact source of statement about whether TypeScript tsc command will remove unused imports by default. I found and confirmed it. But now I have a new question as the title. To be clear let me restate it again:
Since the default behaviour relies on an option preserveValueImports that is deprecated in favor of verbatimModuleSyntax, would the default behaviour of TypeScript tsc change in the future, i.e. not removing unused imports? Tried with nightly playground and unused imports are still removed.
By reading the PR it seems that removing unused imports has been the default since 2015: https://github.com/microsoft/TypeScript/issues/2812. Unfortunately, the two links to the language specs are dead.
Yes, for now.
While it might not be clear at first, you can always test it in the playground. At nightly version
v5.5.0-dev.20240309, the value ofpreserveValueImportsis ignored in favor of the value ofverbatimModuleSyntaxyou have mentioned and it's default tofalsecurrently at the time of my writing.