้•œๅƒ็ซ™็‚น ยท ๆœฌ้กต็”ฑ็ฌฌไธ‰ๆ–น GitHub ๅช่ฏป้•œๅƒๆไพ›๏ผŒ้ž GitHub ๅฎ˜ๆ–น็ซ™็‚น๏ผŒไธๆŽฅๅ—ไปปไฝ•็™ปๅฝ•ๆˆ–ๅ‡ญๆฎ่พ“ๅ…ฅใ€‚ๅ‰ๅพ€ github.com
Skip to content

False negative issues in function type parameters of ts2824ย #64705

Description

@bvanjoi

๐Ÿ”Ž 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions