You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we do not do a great job of reporting unassignable errors. Those are just thrown at the top level with some more or less useful message.
We should:
whenever possible to report the error at the most precise location.
otherwise show a stacktrace of unassignable message like TypeScript but target the root node
For this i think we need to change a few thing:
the whole type relation pipeline needs to not report diagnostics directly but pass some intermediate message so we can build the stacktrace
we should have something to detect if the preceise unassignable target is relevant (probably check if it is a syntax chidren of the passed diagnostic target)
The text was updated successfully, but these errors were encountered:
fix#3291
Changes:
1. Figure out the most accurate location for the diagnostic
2. If diagnostic target a child node of the base diagnostic target then
emit diagnostic directly there
3. Otherwise emit back at the root(or closest child node) and build
stack of error message
Example the following would now emit the error on a
```ts
const b = #{ prop: #{a: "abc"}};
const a: {prop: {}} = b;
```
```
Type '{ prop: { a: "abc" } }' is not assignable to type '{ prop: {} }'
Type '{ a: "abc" }' is not assignable to type '{}'
Object value may only specify known properties, and 'a' does not exist in type '{}'.
```
Previously the error would have been in the complete wrong place
<img width="271" alt="image"
src="https://github.com/user-attachments/assets/c403d1ec-3611-4ad6-87b0-2e0a075dc1c5">
fixmicrosoft#3291
Changes:
1. Figure out the most accurate location for the diagnostic
2. If diagnostic target a child node of the base diagnostic target then
emit diagnostic directly there
3. Otherwise emit back at the root(or closest child node) and build
stack of error message
Example the following would now emit the error on a
```ts
const b = #{ prop: #{a: "abc"}};
const a: {prop: {}} = b;
```
```
Type '{ prop: { a: "abc" } }' is not assignable to type '{ prop: {} }'
Type '{ a: "abc" }' is not assignable to type '{}'
Object value may only specify known properties, and 'a' does not exist in type '{}'.
```
Previously the error would have been in the complete wrong place
<img width="271" alt="image"
src="https://github.com/user-attachments/assets/c403d1ec-3611-4ad6-87b0-2e0a075dc1c5">
Currently we do not do a great job of reporting unassignable errors. Those are just thrown at the top level with some more or less useful message.
We should:
For this i think we need to change a few thing:
The text was updated successfully, but these errors were encountered: