Typescript
Declaration Merging
Please read the Declaration Merging
types.ts
// file blog/src/types.tsinterface BlogItemShape {}export interface AppState {entities: {blog: Record<string, BlogItemShape>;};}
module.d.ts
The module.d.ts
file in all apps is loaded automatically by Typescript
Extend global service manager
// file blog/src/module.d.tsimport '@metafox/framework/Manager';import { BlogList } from './types';declare module '@metafox/framework/Manager' {interface Manager {BlogList?: React.FC<{}>;}}
Extend global state
// file blog/src/module.d.tsimport '@metafox/framework/Manager';import { AppState } from './types';declare module '@metafox/framework/Manager' {interface GlobalState {blog?: AppState;}}