Hacker News new | ask | show | jobs
by vaishnavsm 163 days ago
This seems to be focused on Python, but for all the TS devs out there, what you'll see will be implicit `any` errors. Quick word of warning on having LLMs fix those - they love to use explicit `any`s or perform `as any` casts. This makes the lint error disappear, but keeps the actual logic bug in the code.

Even if you ask it not to use any at all, it'll cast the type to `unknown` and "narrow" it by performing checks. The problem is that this may be syntactically correct but completely meaningless, since it'll narrow it down to a type that doesn't exist.

The biggest problem here is that all of these are valid code patterns, but LLMs tend to abuse them more than using it correctly.

2 comments

We detect any use of any and the LLM has to fix them before our check succeeds. It does and works fine.
currently starting to do the same over seer's frontend, i didn't realise how simple yet effective this technique / guardrail could be!
Default linting in quasarsjs doesn't like unnecessary casts, or using 'any' types - AI generally then fixes it...in varying degrees of effectiveness - sometimes properly, sometimes with horrific type abominations.