diff --git a/src/runtime/component.ts b/src/runtime/component.ts index 61a025ac3..6e4bbd923 100644 --- a/src/runtime/component.ts +++ b/src/runtime/component.ts @@ -23,7 +23,7 @@ export type ComponentConstructor

= (new ( export class Component { static template: string = ""; - static props?: any; + static props?: Schema; static defaultProps?: any; props: Props; diff --git a/src/runtime/portal.ts b/src/runtime/portal.ts index 72d405384..5476e340c 100644 --- a/src/runtime/portal.ts +++ b/src/runtime/portal.ts @@ -65,7 +65,7 @@ export class Portal extends Component { type: String, }, slots: true, - }; + } as const; setup() { const node: any = this.__owl__; diff --git a/src/runtime/validation.ts b/src/runtime/validation.ts index 29063fd4b..36ed9f3ee 100644 --- a/src/runtime/validation.ts +++ b/src/runtime/validation.ts @@ -8,6 +8,7 @@ type BaseType = | typeof Date | typeof Object | typeof Array + | typeof Function | true | "*"; diff --git a/tests/components/props_validation.test.ts b/tests/components/props_validation.test.ts index 265a36ba0..f5f744b07 100644 --- a/tests/components/props_validation.test.ts +++ b/tests/components/props_validation.test.ts @@ -594,7 +594,7 @@ describe("props validation", () => { test("props: can be defined with a boolean", async () => { class SubComp extends Component { - static props = { message: true }; + static props = { message: true } as const; } expect(() => { validateProps(SubComp as any, {}); @@ -636,7 +636,7 @@ describe("props validation", () => { test("props: extra props cause an error, part 2", async () => { class SubComp extends Component { - static props = { message: true }; + static props = { message: true } as const; } expect(() => { validateProps(SubComp as any, { message: 1, flag: true });