Unshare global types

Summary:
This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package.

This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup.

As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same.

Reviewed By: lawrencelomax

Differential Revision: D33124441

fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
This commit is contained in:
Michel Weststrate
2021-12-17 07:34:41 -08:00
committed by Facebook GitHub Bot
parent af3757dcae
commit 5df34a337c
69 changed files with 406 additions and 561 deletions

View File

@@ -14,7 +14,7 @@ import {State as Store} from '../reducers';
import {flush} from '../utils/persistor';
import ToggledSection from './settings/ToggledSection';
import {isEqual} from 'lodash';
import {reportUsage, Settings} from 'flipper-common';
import {Platform, reportUsage, Settings} from 'flipper-common';
import {Modal, Button} from 'antd';
import {Layout, withTrackingScope, _NuxManagerContext} from 'flipper-plugin';
import {getRenderHostInstance} from '../RenderHost';
@@ -23,7 +23,7 @@ const WIZARD_FINISHED_LOCAL_STORAGE_KEY = 'platformSelectWizardFinished';
type OwnProps = {
onHide: () => void;
platform: NodeJS.Platform;
platform: Platform;
};
type StateFromProps = {

View File

@@ -22,7 +22,12 @@ import {FilePathConfigField, ConfigText} from './settings/configFields';
import KeyboardShortcutInput from './settings/KeyboardShortcutInput';
import {isEqual, isMatch, isEmpty} from 'lodash';
import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
import {LauncherSettings, reportUsage, Settings} from 'flipper-common';
import {
LauncherSettings,
Platform,
reportUsage,
Settings,
} from 'flipper-common';
import {Modal, message, Button} from 'antd';
import {Layout, withTrackingScope, _NuxManagerContext} from 'flipper-plugin';
import {getRenderHostInstance} from '../RenderHost';
@@ -30,7 +35,7 @@ import {loadTheme} from '../utils/loadTheme';
type OwnProps = {
onHide: () => void;
platform: NodeJS.Platform;
platform: Platform;
noModal?: boolean; // used for testing
};

View File

@@ -2,7 +2,7 @@
exports[`ShareSheetPendingDialog is rendered with status update 1`] = `
<div
className="css-gzchr8-Container e1hsqii15"
className="css-gzchr8-Container e1k65efv0"
style={
Object {
"textAlign": "center",
@@ -51,7 +51,7 @@ exports[`ShareSheetPendingDialog is rendered with status update 1`] = `
</strong>
</span>
<div
className="css-1knrt0j-SandySplitContainer e1hsqii10"
className="css-1knrt0j-SandySplitContainer e148ues30"
>
<div />
<button
@@ -69,7 +69,7 @@ exports[`ShareSheetPendingDialog is rendered with status update 1`] = `
exports[`ShareSheetPendingDialog is rendered without status update 1`] = `
<div
className="css-gzchr8-Container e1hsqii15"
className="css-gzchr8-Container e1k65efv0"
style={
Object {
"textAlign": "center",
@@ -118,7 +118,7 @@ exports[`ShareSheetPendingDialog is rendered without status update 1`] = `
</strong>
</span>
<div
className="css-1knrt0j-SandySplitContainer e1hsqii10"
className="css-1knrt0j-SandySplitContainer e148ues30"
>
<div />
<button

View File

@@ -3,7 +3,7 @@
exports[`load PluginInstaller list 1`] = `
<div>
<div
class="css-1v0y38i-Container e1hsqii15"
class="css-1v0y38i-Container e1k65efv0"
height="500"
>
<div
@@ -166,7 +166,7 @@ exports[`load PluginInstaller list 1`] = `
width="0"
>
<div
class="css-s1wsbn-Container-Horizontal e1hsqii14"
class="css-s1wsbn-Container-Horizontal e1hsqii12"
>
<span
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
@@ -233,7 +233,7 @@ exports[`load PluginInstaller list 1`] = `
width="0"
>
<div
class="css-s1wsbn-Container-Horizontal e1hsqii14"
class="css-s1wsbn-Container-Horizontal e1hsqii12"
>
<span
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
@@ -379,7 +379,7 @@ exports[`load PluginInstaller list 1`] = `
exports[`load PluginInstaller list with one plugin installed 1`] = `
<div>
<div
class="css-1v0y38i-Container e1hsqii15"
class="css-1v0y38i-Container e1k65efv0"
height="500"
>
<div
@@ -542,7 +542,7 @@ exports[`load PluginInstaller list with one plugin installed 1`] = `
width="0"
>
<div
class="css-s1wsbn-Container-Horizontal e1hsqii14"
class="css-s1wsbn-Container-Horizontal e1hsqii12"
>
<span
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
@@ -609,7 +609,7 @@ exports[`load PluginInstaller list with one plugin installed 1`] = `
width="0"
>
<div
class="css-s1wsbn-Container-Horizontal e1hsqii14"
class="css-s1wsbn-Container-Horizontal e1hsqii12"
>
<span
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"

View File

@@ -141,7 +141,7 @@ const KeyboardShortcutInput = (props: {
}, [isShortcutValid, pressedKeys, props]);
const inputRef = useRef<HTMLInputElement>(null);
let typingTimeout: NodeJS.Timeout;
let typingTimeout: any;
const handleFocusInput = () => {
if (inputRef.current !== null) {