Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions types/office-js-preview/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ declare namespace Office {
* Represents the Device Permission interface.
*/
const devicePermission: DevicePermission;
/**
* Provides options to manage the user interface of an Office Add-in while the add-in is running.
*/
const extensionLifeCycle: ExtensionLifeCycle;
/**
* Represents the ribbon associated with the Office application.
*/
const ribbon: Ribbon;

/**
* Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document.
*
Expand Down
5 changes: 5 additions & 0 deletions types/office-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ declare namespace Office {
* Represents the Device Permission interface.
*/
const devicePermission: DevicePermission;
/**
* Provides options to manage the user interface of an Office Add-in while the add-in is running.
*/
const extensionLifeCycle: ExtensionLifeCycle;
/**
* Represents the ribbon associated with the Office application.
*/
const ribbon: Ribbon;

/**
* Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document.
*
Expand Down
43 changes: 30 additions & 13 deletions types/react-reconciler/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ declare namespace ReactReconciler {
type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;

type Lanes = number;
type Lane = number;

type Lane = number & { __LaneBrand: any };

type Flags = number;

Expand Down Expand Up @@ -941,7 +942,6 @@ declare namespace ReactReconciler {
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
onDefaultTransitionIndicator: () => void,
transitionCallbacks: null | TransitionTracingCallbacks,
): OpaqueRoot;

createPortal(
Expand All @@ -951,8 +951,6 @@ declare namespace ReactReconciler {
key?: string | null,
): ReactPortal;

registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;

createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;

createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
Expand Down Expand Up @@ -987,8 +985,12 @@ declare namespace ReactReconciler {
isStrictMode: boolean,
concurrentUpdatesByDefaultOverride: null | boolean,
identifierPrefix: string,
onRecoverableError: (error: Error) => void,
onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void,
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
onDefaultTransitionIndicator: () => void,
transitionCallbacks: null | TransitionTracingCallbacks,
formState: unknown,
): OpaqueRoot;

updateContainer(
Expand All @@ -998,17 +1000,27 @@ declare namespace ReactReconciler {
callback?: (() => void) | null,
): Lane;

updateContainerSync(
element: ReactNode,
container: OpaqueRoot,
parentComponent?: Component<any, any> | null,
callback?: (() => void) | null,
): Lane;

batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;

deferredUpdates<A>(fn: () => A): A;

discreteUpdates<A, B, C, D, R>(fn: (arg0: A, arg1: B, arg2: C, arg3: D) => R, a: A, b: B, c: C, d: D): R;

flushControlled(fn: () => any): void;

flushSync(): void;
flushSync<R>(fn: () => R): R;

flushSyncFromReconciler(): void;
flushSyncFromReconciler<R>(fn: () => R): R;

flushSyncWork(): boolean;

isAlreadyRendering(): boolean;

flushPassiveEffects(): boolean;
Expand All @@ -1017,16 +1029,10 @@ declare namespace ReactReconciler {

attemptSynchronousHydration(fiber: Fiber): void;

attemptDiscreteHydration(fiber: Fiber): void;

attemptContinuousHydration(fiber: Fiber): void;

attemptHydrationAtCurrentPriority(fiber: Fiber): void;

getCurrentUpdatePriority(): LanePriority;

runWithPriority<T>(priority: LanePriority, fn: () => T): T;

findHostInstance(component: any): PublicInstance | null;

findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
Expand All @@ -1039,6 +1045,17 @@ declare namespace ReactReconciler {

injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
}

function defaultOnUncaughtError(error: Error): void;
function defaultOnCaughtError(error: Error): void;
function defaultOnRecoverableError(error: Error): void;

function startHostTransition(
formFiber: Fiber,
pendingState: unknown,
action: ((formData: FormData) => void) | null,
formData: FormData,
): void;
}

export = ReactReconciler;
2 changes: 1 addition & 1 deletion types/react-reconciler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/react-reconciler",
"version": "0.32.9999",
"version": "0.33.9999",
"projects": [
"https://reactjs.org/"
],
Expand Down
84 changes: 84 additions & 0 deletions types/react-reconciler/test/react-reconciler-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,87 @@ isEqual(Constants.CONCURRENT_ROOT, ReactReconcilerConstants.ConcurrentRoot);

// $ExpectType boolean
isEqual(Constants.NO_EVENT_PRIORITY, ReactReconcilerConstants.NoEventPriority);

// Test createContainer and createHydrationContainer signatures
const TestReconciler = ReactReconciler<
ReactTestHostConfig.Type,
ReactTestHostConfig.Props,
ReactTestHostConfig.Container,
ReactTestHostConfig.Instance,
ReactTestHostConfig.TextInstance,
ReactTestHostConfig.SuspenseInstance,
ReactTestHostConfig.HydratableInstance,
ReactTestHostConfig.FormInstance,
ReactTestHostConfig.PublicInstance,
ReactTestHostConfig.HostContext,
ReactTestHostConfig.ChildSet,
ReactTestHostConfig.TimeoutHandle,
ReactTestHostConfig.NoTimeout,
ReactTestHostConfig.TransitionStatus
>(ReactTestHostConfig);

const container: ReactTestHostConfig.Container = {
children: [],
createNodeMock: () => null,
tag: "CONTAINER",
};

// Test createContainer signature (10 arguments, no transitionCallbacks)
// $ExpectType any
const root = TestReconciler.createContainer(
container,
ReactReconcilerConstants.ConcurrentRoot,
null, // hydrationCallbacks
false, // isStrictMode
null, // concurrentUpdatesByDefaultOverride
"", // identifierPrefix
(error, info) => {}, // onUncaughtError
(error, info) => {}, // onCaughtError
(error, info) => {}, // onRecoverableError
() => {}, // onDefaultTransitionIndicator
);

// Test createHydrationContainer signature (14 arguments including new error handlers and formState)
// $ExpectType any
const hydrationRoot = TestReconciler.createHydrationContainer(
null, // initialChildren
null, // callback
container,
ReactReconcilerConstants.ConcurrentRoot,
null, // hydrationCallbacks
false, // isStrictMode
null, // concurrentUpdatesByDefaultOverride
"", // identifierPrefix
(error, info) => {}, // onUncaughtError
(error, info) => {}, // onCaughtError
(error, info) => {}, // onRecoverableError
() => {}, // onDefaultTransitionIndicator
null, // transitionCallbacks
null, // formState
);

// Use root and hydrationRoot to verify they are valid OpaqueRoot types
TestReconciler.updateContainer(null, root, null);
TestReconciler.updateContainer(null, hydrationRoot, null);

// Test updateContainerSync
// $ExpectType Lane
TestReconciler.updateContainerSync(null, root, null);

// Test flushSyncFromReconciler
// $ExpectType void
TestReconciler.flushSyncFromReconciler();
// $ExpectType string
TestReconciler.flushSyncFromReconciler(() => "test");

// Test flushSyncWork
// $ExpectType boolean
TestReconciler.flushSyncWork();

// Test default error handlers
// $ExpectType void
ReactReconciler.defaultOnUncaughtError(new Error("test"));
// $ExpectType void
ReactReconciler.defaultOnCaughtError(new Error("test"));
// $ExpectType void
ReactReconciler.defaultOnRecoverableError(new Error("test"));