diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index 48b2ea87..38af8515 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -1111,7 +1111,7 @@ export class CodeGenerator { let propVar: string; if ((slotDef && (ast.dynamicProps || hasSlotsProp)) || this.dev) { propVar = this.generateId("props"); - this.addLine(`const ${propVar!} = ${propString}`); + this.addLine(`const ${propVar!} = ${propString};`); propString = propVar!; } @@ -1130,7 +1130,7 @@ export class CodeGenerator { } if (this.dev) { - this.addLine(`helpers.validateProps(${expr}, ${propVar!}, ctx)`); + this.addLine(`helpers.validateProps(${expr}, ${propVar!}, ctx);`); } if (block && (ctx.forceNewBlock === false || ctx.tKeyExpr)) { diff --git a/tests/components/__snapshots__/error_handling.test.ts.snap b/tests/components/__snapshots__/error_handling.test.ts.snap index 8ad895e1..0035f2a8 100644 --- a/tests/components/__snapshots__/error_handling.test.ts.snap +++ b/tests/components/__snapshots__/error_handling.test.ts.snap @@ -6,8 +6,8 @@ exports[`basics display a nice error if it cannot find component (in dev mode) 1 let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SomeMispelledComponent\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SomeMispelledComponent\`, props1, ctx); return component(\`SomeMispelledComponent\`, props1, key + \`__1\`, node, ctx); } }" diff --git a/tests/components/__snapshots__/props_validation.test.ts.snap b/tests/components/__snapshots__/props_validation.test.ts.snap index 60548b0b..47803895 100644 --- a/tests/components/__snapshots__/props_validation.test.ts.snap +++ b/tests/components/__snapshots__/props_validation.test.ts.snap @@ -8,8 +8,8 @@ exports[`default props can set default required boolean values 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -44,8 +44,8 @@ exports[`default props can set default values 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -74,8 +74,8 @@ exports[`default props default values are also set whenever component is updated let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['state'].p} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['state'].p}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -102,8 +102,8 @@ exports[`props validation can specify that additional props are allowed (array) let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - const props1 = {message: 'm',otherProp: 'o'} - helpers.validateProps(\`Child\`, props1, ctx) + const props1 = {message: 'm',otherProp: 'o'}; + helpers.validateProps(\`Child\`, props1, ctx); return component(\`Child\`, props1, key + \`__1\`, node, ctx); } }" @@ -128,8 +128,8 @@ exports[`props validation can specify that additional props are allowed (object) let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - const props1 = {message: 'm',otherProp: 'o'} - helpers.validateProps(\`Child\`, props1, ctx) + const props1 = {message: 'm',otherProp: 'o'}; + helpers.validateProps(\`Child\`, props1, ctx); return component(\`Child\`, props1, key + \`__1\`, node, ctx); } }" @@ -156,8 +156,8 @@ exports[`props validation can validate a prop with multiple types 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -185,8 +185,8 @@ exports[`props validation can validate a prop with multiple types 3`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -214,8 +214,8 @@ exports[`props validation can validate a prop with multiple types 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -230,8 +230,8 @@ exports[`props validation can validate an array with given primitive type 1`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -259,8 +259,8 @@ exports[`props validation can validate an array with given primitive type 3`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -288,8 +288,8 @@ exports[`props validation can validate an array with given primitive type 5`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -304,8 +304,8 @@ exports[`props validation can validate an array with given primitive type 6`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -320,8 +320,8 @@ exports[`props validation can validate an array with multiple sub element types let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -349,8 +349,8 @@ exports[`props validation can validate an array with multiple sub element types let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -378,8 +378,8 @@ exports[`props validation can validate an array with multiple sub element types let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -407,8 +407,8 @@ exports[`props validation can validate an array with multiple sub element types let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -423,8 +423,8 @@ exports[`props validation can validate an object with simple shape 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -452,8 +452,8 @@ exports[`props validation can validate an object with simple shape 3`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -468,8 +468,8 @@ exports[`props validation can validate an object with simple shape 4`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -484,8 +484,8 @@ exports[`props validation can validate an object with simple shape 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -500,8 +500,8 @@ exports[`props validation can validate an optional props 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -529,8 +529,8 @@ exports[`props validation can validate an optional props 3`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -558,8 +558,8 @@ exports[`props validation can validate an optional props 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -574,8 +574,8 @@ exports[`props validation can validate recursively complicated prop def 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -603,8 +603,8 @@ exports[`props validation can validate recursively complicated prop def 3`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -632,8 +632,8 @@ exports[`props validation can validate recursively complicated prop def 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -648,8 +648,8 @@ exports[`props validation default values are applied before validating props at let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['state'].p} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['state'].p}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -678,8 +678,8 @@ exports[`props validation missing required boolean prop causes an error 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -694,8 +694,8 @@ exports[`props validation mix of optional and mandatory 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`Child\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`Child\`, props1, ctx); let b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -710,8 +710,8 @@ exports[`props validation props are validated in dev mode (code snapshot) 1`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {message: 1} - helpers.validateProps(\`Child\`, props1, ctx) + const props1 = {message: 1}; + helpers.validateProps(\`Child\`, props1, ctx); let b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -740,8 +740,8 @@ exports[`props validation props are validated whenever component is updated 1`] let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['state'].p} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['state'].p}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -770,8 +770,8 @@ exports[`props validation props: list of strings 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -786,8 +786,8 @@ exports[`props validation validate simple types 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -802,8 +802,8 @@ exports[`props validation validate simple types 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -831,8 +831,8 @@ exports[`props validation validate simple types 4`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -847,8 +847,8 @@ exports[`props validation validate simple types 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -863,8 +863,8 @@ exports[`props validation validate simple types 6`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -892,8 +892,8 @@ exports[`props validation validate simple types 8`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -908,8 +908,8 @@ exports[`props validation validate simple types 9`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -924,8 +924,8 @@ exports[`props validation validate simple types 10`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -953,8 +953,8 @@ exports[`props validation validate simple types 12`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -969,8 +969,8 @@ exports[`props validation validate simple types 13`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -985,8 +985,8 @@ exports[`props validation validate simple types 14`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1014,8 +1014,8 @@ exports[`props validation validate simple types 16`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1030,8 +1030,8 @@ exports[`props validation validate simple types 17`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1046,8 +1046,8 @@ exports[`props validation validate simple types 18`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1075,8 +1075,8 @@ exports[`props validation validate simple types 20`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1091,8 +1091,8 @@ exports[`props validation validate simple types 21`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1107,8 +1107,8 @@ exports[`props validation validate simple types 22`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1136,8 +1136,8 @@ exports[`props validation validate simple types 24`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1152,8 +1152,8 @@ exports[`props validation validate simple types, alternate form 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1168,8 +1168,8 @@ exports[`props validation validate simple types, alternate form 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1197,8 +1197,8 @@ exports[`props validation validate simple types, alternate form 4`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1213,8 +1213,8 @@ exports[`props validation validate simple types, alternate form 5`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1229,8 +1229,8 @@ exports[`props validation validate simple types, alternate form 6`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1258,8 +1258,8 @@ exports[`props validation validate simple types, alternate form 8`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1274,8 +1274,8 @@ exports[`props validation validate simple types, alternate form 9`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1290,8 +1290,8 @@ exports[`props validation validate simple types, alternate form 10`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1319,8 +1319,8 @@ exports[`props validation validate simple types, alternate form 12`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1335,8 +1335,8 @@ exports[`props validation validate simple types, alternate form 13`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1351,8 +1351,8 @@ exports[`props validation validate simple types, alternate form 14`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1380,8 +1380,8 @@ exports[`props validation validate simple types, alternate form 16`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1396,8 +1396,8 @@ exports[`props validation validate simple types, alternate form 17`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1412,8 +1412,8 @@ exports[`props validation validate simple types, alternate form 18`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1441,8 +1441,8 @@ exports[`props validation validate simple types, alternate form 20`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1457,8 +1457,8 @@ exports[`props validation validate simple types, alternate form 21`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1473,8 +1473,8 @@ exports[`props validation validate simple types, alternate form 22`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1502,8 +1502,8 @@ exports[`props validation validate simple types, alternate form 24`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {p: ctx['p']} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {p: ctx['p']}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } @@ -1518,8 +1518,8 @@ exports[`props validation validation is only done in dev mode 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const props1 = {} - helpers.validateProps(\`SubComp\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`SubComp\`, props1, ctx); let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } diff --git a/tests/components/__snapshots__/t_foreach.test.ts.snap b/tests/components/__snapshots__/t_foreach.test.ts.snap index b97a1d5d..b874ce67 100644 --- a/tests/components/__snapshots__/t_foreach.test.ts.snap +++ b/tests/components/__snapshots__/t_foreach.test.ts.snap @@ -53,8 +53,8 @@ exports[`list of components crash on duplicate key in dev mode 1`] = ` let key1 = 'child'; if (keys1.has(key1)) { throw new Error(\`Got duplicate key in t-foreach: \${key1}\`)} keys1.add(key1); - const props1 = {} - helpers.validateProps(\`Child\`, props1, ctx) + const props1 = {}; + helpers.validateProps(\`Child\`, props1, ctx); c_block1[i1] = withKey(component(\`Child\`, props1, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1);