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

Different type information when using @typescript-eslint with a compat layer #26

Closed
sheremet-va opened this issue Nov 12, 2024 · 6 comments
Labels

Comments

@sheremet-va
Copy link

I wanted to introduce this library to the Vitest monorepo: vitest-dev/vitest#6884

But I cannot figure out the inconsistencies that I encountered and would appreciate some help:

Whatever I do in https://github.com/sheremet-va/vitest/blob/4b068e337c4782167c7aa4be59ad73ee2b96be9f/packages/spy/src/index.ts causes tsslint to think that I always return any even if I cast it or when the type is already known 🤔

Screenshot 2024-11-12 at 14 48 30
@sheremet-va
Copy link
Author

I don't know if this is an issue with the plugin itself or the language server 👀 Reoading the server didn't help, unfortunately

@johnsoncodehk johnsoncodehk moved this to In Progress in Backlogs Nov 13, 2024
@johnsoncodehk johnsoncodehk moved this from In Progress to Done in Backlogs Nov 29, 2024
@johnsoncodehk johnsoncodehk closed this as completed by moving to Done in Backlogs Nov 29, 2024
@sheremet-va
Copy link
Author

Good to know! Thank you for looking into this ❤️

@JoshuaKGoldberg
Copy link

Nit: I don't know that we can conclude this is a bug in typescript-eslint 😅. We'd happily take an issue but:

For enhanceSpy: ReturnType<T> can be any. Procedure's return type is any, so the constraint of T isn't making the return anything more narrow than any.

@sheremet-va
Copy link
Author

Ah, you might be right! The default Procedure has the return type as any 🤔

@johnsoncodehk
Copy link
Owner

@JoshuaKGoldberg Yes this is most likely my misunderstanding of the no-unsafe-return rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants