Conversation
Greptile SummaryThis PR adds a single blank line in
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 9395a1f |
| kind: 'err', | ||
| msg: | ||
| `Compiler pass(es) threw instead of recording errors:\n` + | ||
| unexpectedThrows.map(l => (l.event as any).data).join('\n'), |
There was a problem hiding this comment.
Unsafe cast to any
The (l.event as any).data cast bypasses type safety. Since CompileUnexpectedThrowEvent is a known type with a data field, consider narrowing via a type guard or assertion instead:
| unexpectedThrows.map(l => (l.event as any).data).join('\n'), | |
| unexpectedThrows.map(l => (l.event as {data: string}).data).join('\n'), |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/snap/src/compiler.ts
Line: 389
Comment:
**Unsafe cast to `any`**
The `(l.event as any).data` cast bypasses type safety. Since `CompileUnexpectedThrowEvent` is a known type with a `data` field, consider narrowing via a type guard or assertion instead:
```suggestion
unexpectedThrows.map(l => (l.event as {data: string}).data).join('\n'),
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.Fix the transformFire early-exit in Pipeline.ts to only trigger on new errors from transformFire itself, not pre-existing errors from earlier passes. The previous `env.hasErrors()` check was too broad — it would early-exit on validation errors that existed before transformFire ran. Also add missing blank line in CodegenReactiveFunction.ts Context class, and fix formatting in ValidateMemoizedEffectDependencies.ts.
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35884
Original author: josephsavona
Fix the transformFire early-exit in Pipeline.ts to only trigger on new
errors from transformFire itself, not pre-existing errors from earlier
passes. The previous
env.hasErrors()check was too broad — it wouldearly-exit on validation errors that existed before transformFire ran.
Also add missing blank line in CodegenReactiveFunction.ts Context class,
and fix formatting in ValidateMemoizedEffectDependencies.ts.
Stack created with Sapling. Best reviewed with ReviewStack.