Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnorc committed Feb 18, 2025
1 parent f5a4ba5 commit 6cd0012
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 2 additions & 7 deletions packages/compiler/src/lib/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,15 +875,11 @@ export const $withPickedProperties: WithPickedPropertiesDecorator = (
filterModelPropertiesInPlace(target, (prop) => pickedNames.has(prop.name));
};

function validatePropertyName(
context: DecoratorContext,
target: Model,
name: string
) {
function validatePropertyName(context: DecoratorContext, target: Model, name: string) {
const source = target.templateMapper?.args[0] as Model;
if (source && !source.properties?.has(name)) {
reportDiagnostic(context.program, {
code:"unexpected-property",
code: "unexpected-property",
format: {
propertyName: name,
type: getTypeName(source),
Expand All @@ -893,7 +889,6 @@ function validatePropertyName(
}
}


// -- @withoutDefaultValues decorator ----------------------

export const $withoutDefaultValues: WithoutDefaultValuesDecorator = (
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler/test/decorators/decorators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,8 @@ describe("compiler: built-in decorators", () => {
expectDiagnostics(diagnostics, [
{
code: "unexpected-property",
message: "Object value may only specify known properties, and 'notMee' does not exist in type 'OriginalModel'.",
message:
"Object value may only specify known properties, and 'notMee' does not exist in type 'OriginalModel'.",
},
]);
});
Expand Down

0 comments on commit 6cd0012

Please sign in to comment.