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:
committed by
Facebook GitHub Bot
parent
af3757dcae
commit
5df34a337c
@@ -144,7 +144,7 @@ export function DataTable<T extends object>(
|
||||
const isUnitTest = useInUnitTest();
|
||||
|
||||
// eslint-disable-next-line
|
||||
const scope = isUnitTest ? "" : usePluginInstanceMaybe()?.pluginKey ?? "";
|
||||
const scope = isUnitTest ? '' : usePluginInstanceMaybe()?.pluginKey ?? '';
|
||||
const virtualizerRef = useRef<DataSourceVirtualizer | undefined>();
|
||||
const [tableState, dispatch] = useReducer(
|
||||
dataTableManagerReducer as DataTableReducer<T>,
|
||||
@@ -344,7 +344,12 @@ export function DataTable<T extends object>(
|
||||
// Important dep optimization: we don't want to recalc filters if just the width or visibility changes!
|
||||
// We pass entire state.columns to computeDataTableFilter, but only changes in the filter are a valid cause to compute a new filter function
|
||||
// eslint-disable-next-line
|
||||
[tableState.searchValue, tableState.useRegex, ...tableState.columns.map((c) => c.filters), ...tableState.columns.map((c => c.inversed))],
|
||||
[
|
||||
tableState.searchValue,
|
||||
tableState.useRegex,
|
||||
...tableState.columns.map((c) => c.filters),
|
||||
...tableState.columns.map((c) => c.inversed),
|
||||
],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
@@ -398,7 +403,7 @@ export function DataTable<T extends object>(
|
||||
|
||||
/** Range finder */
|
||||
const [range, setRange] = useState('');
|
||||
const hideRange = useRef<NodeJS.Timeout>();
|
||||
const hideRange = useRef<any>();
|
||||
|
||||
const onRangeChange = useCallback(
|
||||
(start: number, end: number, total: number, offset) => {
|
||||
@@ -425,7 +430,7 @@ export function DataTable<T extends object>(
|
||||
const contexMenu = isUnitTest
|
||||
? undefined
|
||||
: // eslint-disable-next-line
|
||||
useCallback(
|
||||
useCallback(
|
||||
() =>
|
||||
tableContextMenuFactory(
|
||||
dataSource,
|
||||
|
||||
Reference in New Issue
Block a user