Skip to content

Commit

Permalink
Improve globals.d.ts (#3626)
Browse files Browse the repository at this point in the history
This PR eliminates differences between two sections in `globals.d.ts`.
Also, two types needed to be fixed.
  • Loading branch information
tomekzaw authored and piaskowyk committed Oct 14, 2022
1 parent 923fc7b commit fb89601
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions src/reanimated2/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { AnimatedStyle, StyleProps } from './commonTypes';
import { AnimatedStyle, StyleProps, MeasuredDimensions } from './commonTypes';
import { ReanimatedConsole } from './core';
import FrameCallbackRegistryUI from './frameCallback/FrameCallbackRegistryUI';
import { MeasuredDimensions } from './NativeMethods';
import { NativeReanimated } from './NativeReanimated/NativeReanimated';

declare global {
const _WORKLET: boolean;
const _frameTimestamp: number;
const _frameTimestamp: number | null;
const _eventTimestamp: number;
const __reanimatedModuleProxy: NativeReanimated;
const _setGlobalConsole: (console?: ReanimatedConsole) => void;
const _log: (s: string) => void;
const _getCurrentTime: () => number;
const _stopObservingProgress: (tag: number, flag: boolean) => void;
const _startObservingProgress: (
Expand All @@ -20,28 +21,48 @@ declare global {
name: string,
updates: StyleProps | AnimatedStyle
) => void;
const _measure: (viewTag: number) => MeasuredDimensions | null;
const _measure: (viewTag: number) => MeasuredDimensions;
const _scrollTo: (
viewTag: number,
x: number,
y: number,
animated: boolean
) => void;
const _chronoNow: () => number;
const performance: { now: () => number };
const LayoutAnimationRepository: {
configs: Record<string, unknown>;
registerConfig(tag: number, config: Record<string, unknown>): void;
removeConfig(tag: number): void;
startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;
};
const ReanimatedDataMock: {
now: () => number;
};
const _frameCallbackRegistry: FrameCallbackRegistryUI;

namespace NodeJS {
interface Global {
_setGlobalConsole: (console?: ReanimatedConsole) => void;
_log: (s: string) => void;
_setGestureState: () => void;
_WORKLET: boolean;
__reanimatedModuleProxy: NativeReanimated;
_IS_FABRIC: boolean;
_frameTimestamp: number | null;
_measure: () => MeasuredDimensions | null;
_scrollTo: () => void;
_eventTimestamp: number;
__reanimatedModuleProxy: NativeReanimated;
_setGlobalConsole: (console?: ReanimatedConsole) => void;
_log: (s: string) => void;
_getCurrentTime: () => number;
_stopObservingProgress: (tag: number, flag: boolean) => void;
_startObservingProgress: (
tag: number,
flag: { value: boolean; _value: boolean }
) => void;
_setGestureState: (handlerTag: number, newState: number) => void;
_measure: (viewTag: number) => MeasuredDimensions;
_scrollTo: (
viewTag: number,
x: number,
y: number,
animated: boolean
) => void;
_chronoNow: () => number;
performance: { now: () => number };
LayoutAnimationRepository: {
Expand All @@ -57,7 +78,6 @@ declare global {
ReanimatedDataMock: {
now: () => number;
};
_frameCallbackRegistry: FrameCallbackRegistryUI;
}
}
}

0 comments on commit fb89601

Please sign in to comment.