mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] types: make component generic types optional
In most cases, we just want Component<any, Env>. But since it was so annoying to have always the type Env, we actually used Component<any,any> everywhere. With this commit, the generic types have a default (and their order is swapped), so we can simply use Component in most cases, and Component<Props> when we want to type the props.
This commit is contained in:
@@ -33,9 +33,9 @@ describe("RouteComponent", () => {
|
||||
<span t-name="Users">Users</span>
|
||||
</templates>
|
||||
`);
|
||||
class About extends Component<any, any> {}
|
||||
class Users extends Component<any, any> {}
|
||||
class App extends Component<any, any> {
|
||||
class About extends Component {}
|
||||
class Users extends Component {}
|
||||
class App extends Component {
|
||||
static components = { RouteComponent };
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ describe("RouteComponent", () => {
|
||||
<span t-name="Book">Book <t t-esc="props.title"/></span>
|
||||
</templates>
|
||||
`);
|
||||
class Book extends Component<any, any> {}
|
||||
class App extends Component<any, any> {
|
||||
class Book extends Component {}
|
||||
class App extends Component {
|
||||
static components = { RouteComponent };
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ describe("RouteComponent", () => {
|
||||
<span t-name="Book">Book <t t-esc="props.title"/>|<t t-esc="incVal"/></span>
|
||||
</templates>
|
||||
`);
|
||||
class Book extends Component<any, any> {
|
||||
class Book extends Component {
|
||||
get incVal() {
|
||||
return this.props.val + 1;
|
||||
}
|
||||
}
|
||||
class App extends Component<any, any> {
|
||||
class App extends Component {
|
||||
static components = { RouteComponent };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user