Closed
Description
π Search Terms
binding element alias declaration files
π Version & Regression Information
- This changed between versions 4.7 and 4.8
β― Playground Link
π» Code
// β
// Should not be kept and is removed
function shouldNotKeep ({ name: alias }: { name: string }) {
}
// β
// Alias is used in the function but not in the signature
// Should not be kept in declarations as it is an implementation detail
// symbol.isReferenced is used which checks references anywhere.
function shouldNotKeepButIsKept ({ name: alias }: { name: string }){
return alias
}
// β
// Used in return type (could pe parameters types as well) so it should be kept
function shoudlKeep ({ name: alias }: { name: string }): typeof alias {
return alias
}
π Actual behavior
alias
is kept in declaration files for shouldNotKeepButIsKept
π Expected behavior
Either alias
is removed from declaration file for shouldNotKeepButIsKept
, or alias
is also kept for shouldNotKeep
.
Additional information about the issue
Seems like declaration emit is using isReferenced
of the symbol. But this tracks usage of the symbol anywhere in the scope, we would need usage of the symbol in the function signature.