Getting Started
Backend
Frontend
Getting StartedConceptsCookieDialogFormGridviewLayoutsLocal StorageRouterThemeTypescriptDeclaration MergingValidationsagasservice
ExampleLanguage

Typescript

Declaration Merging

Please read the Declaration Merging

types.ts

// file blog/src/types.ts
interface 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.ts
import '@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.ts
import '@metafox/framework/Manager';
import { AppState } from './types';
declare module '@metafox/framework/Manager' {
interface GlobalState {
blog?: AppState;
}
}
Top