๐ Search Terms
2824, unused renaming
๐ Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ.
โฏ Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAZgBgFwwDwEEB8AKA3gQxXQF8UCjiBKGAXkxgDcQBLAE1pm2rpl2IG4gA
๐ป Code
const f0: <A>({a: A}: {a: A}) => void = () => {};
// ~ It should report error TS2824 because the renamed A is a value and is never used.
๐ Actual behavior
check pass.
๐ Expected behavior
see the comment.
Additional information about the issue
A straightforward fix might be:
for _, node := range c.renamedBindingElementsInTypes {
- if c.symbolReferenceLinks.Get(c.getSymbolOfDeclaration(node)).referenceKinds == 0 {
+ if c.symbolReferenceLinks.Get(c.getSymbolOfDeclaration(node)).referenceKinds&ast.SymbolFlagsVariable == 0 {
wrappingDeclaration := ast.WalkUpBindingElementsAndPatterns(node)
https://github.com/microsoft/TypeScript/blob/6ad8c56f9b5a9bb910046c56059296311adc24ba/tsc/internal/checker/checker.go#L7518-L7520
๐ Search Terms
2824, unused renaming
๐ Version & Regression Information
โฏ Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAZgBgFwwDwEEB8AKA3gQxXQF8UCjiBKGAXkxgDcQBLAE1pm2rpl2IG4gA
๐ป Code
๐ Actual behavior
check pass.
๐ Expected behavior
see the comment.
Additional information about the issue
A straightforward fix might be:
for _, node := range c.renamedBindingElementsInTypes { - if c.symbolReferenceLinks.Get(c.getSymbolOfDeclaration(node)).referenceKinds == 0 { + if c.symbolReferenceLinks.Get(c.getSymbolOfDeclaration(node)).referenceKinds&ast.SymbolFlagsVariable == 0 { wrappingDeclaration := ast.WalkUpBindingElementsAndPatterns(node)https://github.com/microsoft/TypeScript/blob/6ad8c56f9b5a9bb910046c56059296311adc24ba/tsc/internal/checker/checker.go#L7518-L7520