Skip to content

Commit 4d9c6c8

Browse files
committed
fix typo
for context: the indices in `reduce()` start from 1 because `initialValue` is provided (set to `""`)
1 parent 1ea0ea5 commit 4d9c6c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DocumentComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DocumentComponent extends NodeComponent<DocumentFragment> {
3030
*/
3131
public static tag(strings: TemplateStringsArray, ...components: NodeComponent<any>[]): DocumentComponent {
3232
const idPrefix = "tag-" + crypto.randomUUID() + "-";
33-
const doc = new DocumentComponent(strings.reduce((acc, str, index) => acc += `${str}${index < components.length ? `<slot name="${idPrefix}${index + 1}"></slot>` : ""}`, ""));
33+
const doc = new DocumentComponent(strings.reduce((acc, str, index) => acc += `${str}${index < components.length ? `<slot name="${idPrefix}${index - 1}"></slot>` : ""}`, ""));
3434
for (const [index, component] of components.entries())
3535
component.slot(idPrefix + index, doc.node);
3636
return doc;

0 commit comments

Comments
 (0)