[FIX] typing: Component class should be generic on Props and Env

Otherwise, it prevents proper typing with typescript
This commit is contained in:
Géry Debongnie
2022-01-17 10:18:45 +01:00
committed by Aaron Bohy
parent 4f35f03986
commit 99b5e9ec55
3 changed files with 6 additions and 7 deletions
@@ -93,7 +93,7 @@ exports[`t-props t-props with props 1`] = `
let block1 = createBlock(\`<div><block-child-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2 = component(\`Child\`, Object.assign({}, ctx['props'], {a: 1,b: 2}), key + \`__1\`, node, ctx);
let b2 = component(\`Child\`, Object.assign({}, ctx['childProps'], {a: 1,b: 2}), key + \`__1\`, node, ctx);
return block1([], [b2]);
}
}"
+2 -2
View File
@@ -95,12 +95,12 @@ describe("t-props", () => {
class Parent extends Component {
static template = xml`
<div>
<Child t-props="props" a="1" b="2" />
<Child t-props="childProps" a="1" b="2" />
</div>
`;
static components = { Child };
props = { a: "a", c: "c" };
childProps = { a: "a", c: "c" };
}
await mount(Parent, fixture);