Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Sep 6, 2024
1 parent a0f2d5c commit 0e11b62
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/compiler/test/checker/relation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,29 @@ describe("relation error target and messages", () => {
});
});

it("report multiple extra property at assignment right on the property literal", async () => {
const { source: sourceTmp, ...pos1 } = extractSquiggles(
`const a: {} = #{┆a: "abc"┆, ┆b: "abc"┆};`,
"┆"
);
const { source, ...pos2 } = extractSquiggles(sourceTmp, "┆");
const diagnostics = await runner.diagnose(source);
expectDiagnostics(diagnostics, [
{
code: "unexpected-property",
message:
"Object value may only specify known properties, and 'a' does not exist in type '{}'.",
...pos1,
},
{
code: "unexpected-property",
message:
"Object value may only specify known properties, and 'b' does not exist in type '{}'.",
...pos2,
},
]);
});

it("report extra property at assignment right on the property literal (nested)", async () => {
await expectRelationDiagnostics(`const a: {prop: {}} = #{ prop: #{┆a: "abc"┆}};`, {
code: "unexpected-property",
Expand Down

0 comments on commit 0e11b62

Please sign in to comment.