Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semantic: imported type is used but a warning message appears #5435

Closed
btea opened this issue Sep 4, 2024 · 4 comments · Fixed by #5441 or #5525
Closed

semantic: imported type is used but a warning message appears #5435

btea opened this issue Sep 4, 2024 · 4 comments · Fixed by #5441 or #5525
Assignees
Labels
A-semantic Area - Semantic C-bug Category - Bug

Comments

@btea
Copy link

btea commented Sep 4, 2024

When you import a type and then use this type as the key of an interface, a warning message will appear saying that this type is not used and it is recommended to remove it.

The sample code is as follows:

import type a from 'b'

export interface A {
  [a]: 'test' | '10'
}

I created a repro link with the above code, and you can see the warning message when you open it.

@btea btea added the C-bug Category - Bug label Sep 4, 2024
@Dunqing Dunqing added the A-semantic Area - Semantic label Sep 4, 2024
@Dunqing
Copy link
Member

Dunqing commented Sep 4, 2024

Thank you for the feedback!

@Dunqing Dunqing self-assigned this Sep 4, 2024
@Boshen Boshen changed the title The imported type is used but a warning message appears semantic: imported type is used but a warning message appears Sep 4, 2024
Boshen pushed a commit that referenced this issue Sep 5, 2024
…not reference type-only import binding (#5441)

close: #5435

The behavior of `IdentifierReference` in `TSPropertySignature` is the same as in `TSTypeQuery`, both allow only reference value bindings and type-only import bindings.

I still use `ReferenceFlags::TSTypeQuery` here because I want to avoid producing many changes unrelated to the bug in this PR. I will refactor it in the follow-up PR soon
@Dunqing Dunqing closed this as completed Sep 5, 2024
@btea
Copy link
Author

btea commented Sep 5, 2024

So efficient! 👍

@btea
Copy link
Author

btea commented Sep 6, 2024

@Dunqing I found that there are still problems in some scenarios, such as when a property of the imported type is used as a key, for example.

@Dunqing
Copy link
Member

Dunqing commented Sep 6, 2024

@Dunqing I found that there are still problems in some scenarios, such as when a property of the imported type is used as a key, for example.

Thanks for the report! same problem.

Boshen pushed a commit that referenced this issue Sep 6, 2024
@Dunqing Dunqing closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment