diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 101ebbd7c6f81c..1920ceff604ab5 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -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. * diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f46765be6db9b9..bd566426b7bf2f 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -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. * diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index 78f809ef7b6dc6..c0762387a68005 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -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; @@ -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( @@ -951,8 +951,6 @@ declare namespace ReactReconciler { key?: string | null, ): ReactPortal; - registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void; - createComponentSelector(component: React$AbstractComponent): ComponentSelector; createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector; @@ -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( @@ -998,17 +1000,27 @@ declare namespace ReactReconciler { callback?: (() => void) | null, ): Lane; + updateContainerSync( + element: ReactNode, + container: OpaqueRoot, + parentComponent?: Component | null, + callback?: (() => void) | null, + ): Lane; + batchedUpdates(fn: (a: A) => R, a: A): R; deferredUpdates(fn: () => A): A; discreteUpdates(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(fn: () => R): R; + flushSyncFromReconciler(): void; + flushSyncFromReconciler(fn: () => R): R; + + flushSyncWork(): boolean; + isAlreadyRendering(): boolean; flushPassiveEffects(): boolean; @@ -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(priority: LanePriority, fn: () => T): T; - findHostInstance(component: any): PublicInstance | null; findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null; @@ -1039,6 +1045,17 @@ declare namespace ReactReconciler { injectIntoDevTools(devToolsConfig: DevToolsConfig): 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; diff --git a/types/react-reconciler/package.json b/types/react-reconciler/package.json index 8dce064263f28b..cfd8570153ebd7 100644 --- a/types/react-reconciler/package.json +++ b/types/react-reconciler/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/react-reconciler", - "version": "0.32.9999", + "version": "0.33.9999", "projects": [ "https://reactjs.org/" ], diff --git a/types/react-reconciler/test/react-reconciler-tests.ts b/types/react-reconciler/test/react-reconciler-tests.ts index 44917ae022f3b8..887c633321dbbb 100644 --- a/types/react-reconciler/test/react-reconciler-tests.ts +++ b/types/react-reconciler/test/react-reconciler-tests.ts @@ -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"));