complete performance and reliability follow-ups

This commit is contained in:
2026-08-09 23:04:36 +05:30
parent 8f19a5eb2b
commit 232d8e6734
31 changed files with 525 additions and 726 deletions
@@ -45,7 +45,7 @@ export interface CounterOutputs {
"change"(value: number): void;
}
function __coerce(v: any, def: any, declared: string = "unknown", propName: string = "prop"): any {
function __coerce(v: unknown, def: unknown, declared: string = "unknown", propName: string = "prop"): unknown {
if (v === undefined || v === null) {
return def;
}
@@ -105,7 +105,7 @@ function __coerce(v: any, def: any, declared: string = "unknown", propName: stri
throw new TypeError("Expected an object prop '" + propName + "'");
}
if (declared === "bigint") return BigInt(v);
if (declared === "bigint") return BigInt(v as string | number | bigint | boolean);
if (declared === "function" && typeof v !== "function") {
throw new TypeError("Expected a function prop");
}
@@ -113,15 +113,15 @@ function __coerce(v: any, def: any, declared: string = "unknown", propName: stri
}
function __restProps(
props: Record<string, any>,
props: Record<string, unknown>,
declared: Set<string>,
): Record<string, any> {
): Record<string, unknown> {
return Object.fromEntries(
Object.entries(props).filter(([name]) => !declared.has(name)),
);
}
function __wireHtml(v: any): string {
function __wireHtml(v: unknown): string {
return String(v == null ? "" : v).replace(
/[&<>]/g,
(c) =>
@@ -133,7 +133,7 @@ function __wireHtml(v: any): string {
);
}
function __wireAttr(v: any): string {
function __wireAttr(v: unknown): string {
return String(v == null ? "" : v).replace(
/[&<>"]/g,
(c) =>
@@ -147,7 +147,7 @@ function __wireAttr(v: any): string {
);
}
function __wireBooleanAttr(name: string, value: any): string {
function __wireBooleanAttr(name: string, value: unknown): string {
return value === true ||
value === "true" ||
value === "" ||
@@ -158,7 +158,7 @@ function __wireBooleanAttr(name: string, value: any): string {
: "";
}
function __wireSpreadAttrs(value: any): string {
function __wireSpreadAttrs(value: unknown): string {
if (value === null || typeof value !== "object" || Array.isArray(value)) return "";
const booleanAttributes = new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);
@@ -194,7 +194,7 @@ function __wireSpreadAttrs(value: any): string {
return attributes.join("");
}
function __wireProp(v: any): string {
function __wireProp(v: unknown): string {
const value =
v !== null && typeof v === "object"
? JSON.stringify(v)
@@ -203,11 +203,11 @@ function __wireProp(v: any): string {
return __wireAttr(value);
}
function __wireRaw(v: any): string {
function __wireRaw(v: unknown): string {
return String(v == null ? "" : v);
}
function __wrnexusSerializeScopeValue(value: any): string {
function __wrnexusSerializeScopeValue(value: unknown): string {
if (value === undefined) {
return "undefined";
}
@@ -241,7 +241,7 @@ function __wrnexusSerializeScopeValue(value: any): string {
}
}
function __wrnexusScopeDecl(obj: Record<string, any>): string {
function __wrnexusScopeDecl(obj: Record<string, unknown>): string {
return Object.keys(obj)
.map(
(key) =>
@@ -260,7 +260,7 @@ function __wrnexusSerializeScopeValue(value: any): string {
export function render(props: CounterProps = {} as CounterProps): string {
const __p = props || {};
const label: string = __coerce(__p["label"], ("Count"), "string", "label");
const label: string = __coerce(__p["label"], ("Count"), "string", "label") as string;
const __attrs = __restProps(__p, new Set(["label"]));
let count = (0);
const __scopeState = { "label": label, "count": count };