Skip to content

Error messages: Improve "Somewhere wanted" messages #6410

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

Merged
merged 14 commits into from
Sep 26, 2023
Prev Previous commit
Next Next commit
tweak set record field message
  • Loading branch information
zth committed Sep 22, 2023
commit a412502aa9eb4e1e560b39384e28419baf8a778f
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
11 │ user.name = 12
12 │

This has type: int
You're assigning something to this field that has type: int
But this record field is of type: string

You can convert int to string with Belt.Int.toString.
1 change: 1 addition & 0 deletions jscomp/ml/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ let print_expr_type_clash ?typeClashContext env trace ppf = begin
| Some (Statement(FunctionCall)) -> "This function call returns:"
| Some (MathOperator{isConstant=Some _}) -> "This value has type:"
| Some (ArrayValue) -> "This array item has type:"
| Some SetRecordField -> "You're assigning something to this field that has type:"
| _ -> "This has type:"
) in
fprintf ppf "%s" text)
Expand Down