Migrate index.js to use Typescript (#129)
* Migrate index.js to use Typescript * Fix tests
This commit is contained in:
parent
18d30b50bc
commit
d9532472eb
9 changed files with 326 additions and 101 deletions
|
@ -1,10 +0,0 @@
|
|||
import manifest from './manifest';
|
||||
|
||||
export default class Plugin {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
initialize(registry, store) {
|
||||
// @see https://developers.mattermost.com/extend/plugins/webapp/reference/
|
||||
}
|
||||
}
|
||||
|
||||
window.registerPlugin(manifest.id, new Plugin());
|
23
webapp/src/index.tsx
Normal file
23
webapp/src/index.tsx
Normal file
|
@ -0,0 +1,23 @@
|
|||
import {Store, Action} from 'redux';
|
||||
|
||||
import {GlobalState} from 'mattermost-redux/types/store';
|
||||
|
||||
import manifest from './manifest';
|
||||
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import {PluginRegistry} from './types/mattermost-webapp';
|
||||
|
||||
export default class Plugin {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
||||
public async initialize(registry: PluginRegistry, store: Store<GlobalState, Action<Record<string, unknown>>>) {
|
||||
// @see https://developers.mattermost.com/extend/plugins/webapp/reference/
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
registerPlugin(id: string, plugin: Plugin): void
|
||||
}
|
||||
}
|
||||
|
||||
window.registerPlugin(manifest.id, new Plugin());
|
5
webapp/src/types/mattermost-webapp/index.d.ts
vendored
Normal file
5
webapp/src/types/mattermost-webapp/index.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
export interface PluginRegistry {
|
||||
registerPostTypeComponent(typeName: string, component: React.ElementType)
|
||||
|
||||
// Add more if needed from https://developers.mattermost.com/extend/plugins/webapp/reference
|
||||
}
|
Reference in a new issue