@xaendar/compiler 0.7.29 → 0.7.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2917,7 +2917,9 @@ function typeCheckElement(node, processNode, context) {
2917
2917
  if (typeof value !== "string") lines.push(`${resolveExpression(value.expression, context, { resolver: "root" })};`);
2918
2918
  });
2919
2919
  node.events.forEach(({ handler, parameters }) => {
2920
- const args = parameters.map((parameter) => resolveExpression(parameter, context, { resolver: "root" })).join(", ");
2920
+ const eventContext = new CompilerContext([], context);
2921
+ eventContext.addUnresolvableIdentifier("$event");
2922
+ const args = parameters.map((parameter) => resolveExpression(parameter, eventContext, { resolver: "root" })).join(", ");
2921
2923
  lines.push(`root.${handler}(${args});`);
2922
2924
  });
2923
2925
  node.children.forEach((child) => lines.push(...processNode(child, context)));
@@ -3099,10 +3101,9 @@ var TypeChecker = class {
3099
3101
  * relevant if the consuming project has `noUnusedLocals` enabled.
3100
3102
  */
3101
3103
  generate() {
3102
- const body = this._ast.flatMap((node) => this._processNode(node));
3103
3104
  return [
3104
3105
  "function typeCheck() {",
3105
- ...indent(body.some((line) => line.includes("$event")) ? ["let $event!: Event;", ...body] : body),
3106
+ ...indent(this._ast.flatMap((node) => this._processNode(node))),
3106
3107
  "}"
3107
3108
  ].join("\n");
3108
3109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/compiler",
3
- "version": "0.7.29",
3
+ "version": "0.7.30",
4
4
  "description": "A library for transpiling Xaendar Templates into JavaScript code",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -16,8 +16,8 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@xaendar/common": "0.7.29",
20
- "@xaendar/types": "0.7.29",
19
+ "@xaendar/common": "0.7.30",
20
+ "@xaendar/types": "0.7.30",
21
21
  "typescript": "^6.0.3"
22
22
  }
23
23
  }