Convert plugin.js to plugin.tsx
Summary: * Deletes plugin.js * Adds plugin.tsx * Adds plugin flow-typed module that has the old flow types Reviewed By: passy Differential Revision: D16668067 fbshipit-source-id: b2f0ce47c4cf7125b4e352821e921b97675d12a9
This commit is contained in:
committed by
Facebook Github Bot
parent
5f53087c7e
commit
3bfb7faf0a
@@ -15,7 +15,9 @@ import {
|
||||
updateCategoryBlacklist,
|
||||
} from '../notifications';
|
||||
|
||||
const notification = {
|
||||
import {Notification} from '../../plugin';
|
||||
|
||||
const notification: Notification = {
|
||||
id: 'id',
|
||||
title: 'title',
|
||||
message: 'message',
|
||||
|
||||
@@ -14,17 +14,18 @@ import {
|
||||
FlipperBasePlugin,
|
||||
FlipperPlugin,
|
||||
FlipperDevicePlugin,
|
||||
} from '../../plugin.js';
|
||||
BaseAction,
|
||||
} from '../../plugin';
|
||||
|
||||
const testBasePlugin = class extends FlipperBasePlugin {
|
||||
const testPlugin = class extends FlipperPlugin<any, BaseAction, any> {
|
||||
static id = 'TestPlugin';
|
||||
};
|
||||
|
||||
const testPlugin = class extends FlipperPlugin {
|
||||
static id = 'TestPlugin';
|
||||
};
|
||||
|
||||
const testDevicePlugin = class extends FlipperDevicePlugin {
|
||||
const testDevicePlugin = class extends FlipperDevicePlugin<
|
||||
any,
|
||||
BaseAction,
|
||||
any
|
||||
> {
|
||||
static id = 'TestDevicePlugin';
|
||||
};
|
||||
|
||||
@@ -73,22 +74,6 @@ test('do not add plugin twice', () => {
|
||||
expect(res.clientPlugins.size).toEqual(1);
|
||||
});
|
||||
|
||||
test('do not add other classes', () => {
|
||||
const res = reducer(
|
||||
{
|
||||
devicePlugins: new Map(),
|
||||
clientPlugins: new Map(),
|
||||
gatekeepedPlugins: [],
|
||||
failedPlugins: [],
|
||||
disabledPlugins: [],
|
||||
selectedPlugins: [],
|
||||
},
|
||||
registerPlugins([testBasePlugin]),
|
||||
);
|
||||
expect(res.devicePlugins.size).toEqual(0);
|
||||
expect(res.devicePlugins.size).toEqual(0);
|
||||
});
|
||||
|
||||
test('add gatekeeped plugin', () => {
|
||||
const gatekeepedPlugins = [{name: 'plugin', out: 'out.js'}];
|
||||
const res = reducer(
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin.js';
|
||||
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin';
|
||||
import {PluginDefinition} from '../dispatcher/plugins';
|
||||
|
||||
export type State = {
|
||||
@@ -64,10 +64,10 @@ export default function reducer(
|
||||
|
||||
// $FlowFixMe Flow doesn't know prototype
|
||||
if (p.prototype instanceof FlipperDevicePlugin) {
|
||||
// $FlowFixMe Flow doesn't know p must be Class<FlipperDevicePlugin> here
|
||||
// @ts-ignore doesn't know p must be typeof FlipperDevicePlugin here
|
||||
devicePlugins.set(p.id, p);
|
||||
} else if (p.prototype instanceof FlipperPlugin) {
|
||||
// $FlowFixMe Flow doesn't know p must be Class<FlipperPlugin> here
|
||||
// @ts-ignore doesn't know p must be typeof FlipperPlugin here
|
||||
clientPlugins.set(p.id, p);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user