Do not remove binding alias in function declarations by dragomirtitian · Pull Request #57020 · microsoft/TypeScript (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error for unused renames is still there. I did not remove it. It only seems to pop up on some kinds of declarations for example function types let o: ({n : a}: any) => void;

Just to point out an example from the PR, this is code that I believed would have gained an error: https://www.typescriptlang.org/play?#code/C4TwDgpgBA8lC8UDeBYAUFTUCGB+AXFAM7ABOAlgHYDmA3OllAEaGUCuAtkxKfRlgGNWnbr3QBfPulCQoAMQBMCKAAokOQiQo0o4wjACUCAHw5KIWkA

Yet, there's no error baseline. That being said, it looks like for declaration files we straight up skip checking the final list:

if (!node.isDeclarationFile) {
    checkPotentialUncheckedRenamedBindingElementsInTypes();
}

So, I think everything is fine? (Other than that I don't think it makes any sense that we still collect potentialUnusedRenamedBindingElementsInTypes in declaration files only to not read them later, which is not new.)