Skip to content

Commit

Permalink
docs: Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
finom committed Jun 1, 2023
1 parent cda6a58 commit e6560de
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,23 +539,23 @@ export class UsersProtected extends UsersPublic { // inherit it from UsersPublic
}
}

const users = new Users();
const users = new UsersProtected();

export const { loadUsers } = users;

export default users as UsersPublic; // override
```
Use the same pattern at the root store to make `RootStore['users']` and other sub-stores to have all "private" members available.
Use the same pattern at the root store to make `RootStore['users']` and other sub-stores to have all "protected" members available.
```ts
import Use0 from 'use-0';
import users, { type Users } from './users';
import companies, { type Companies } from './companies';
import users, { type UsersProtected } from './users';
import companies, { type CompaniesProtected } from './companies';

export class RootStore extends Use0 {
readonly users = users as Users; // override back
readonly companies = companies as Companies;
readonly users = users as UsersProtected; // override back
readonly companies = companies as CompaniesProtected;
constructor() {
super();
this.users.init(this);
Expand Down

0 comments on commit e6560de

Please sign in to comment.