From d6556b5047c8895cf461834c47583dc26d520595 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Sun, 16 Feb 2025 13:23:04 +0100 Subject: [PATCH] [react] Move `captureOwnerStack` to Canary build (#71731) --- types/react/canary.d.ts | 7 +++++++ types/react/experimental.d.ts | 5 ----- types/react/test/canary.tsx | 5 +++++ types/react/test/experimental.tsx | 5 ----- types/react/ts5.0/canary.d.ts | 7 +++++++ types/react/ts5.0/experimental.d.ts | 5 ----- types/react/ts5.0/test/canary.tsx | 5 +++++ types/react/ts5.0/test/experimental.tsx | 5 ----- 8 files changed, 24 insertions(+), 20 deletions(-) diff --git a/types/react/canary.d.ts b/types/react/canary.d.ts index 9215a16bb87bab..3884df9d9a683d 100644 --- a/types/react/canary.d.ts +++ b/types/react/canary.d.ts @@ -32,4 +32,11 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export function unstable_useCacheRefresh(): () => void; + + /** + * Warning: Only available in development builds. + * + * @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs} + */ + function captureOwnerStack(): string | null; } diff --git a/types/react/experimental.d.ts b/types/react/experimental.d.ts index 006af56481dbdc..1a7f130f42c1b9 100644 --- a/types/react/experimental.d.ts +++ b/types/react/experimental.d.ts @@ -109,11 +109,6 @@ declare module "." { // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type export function experimental_useEffectEvent(event: T): T; - /** - * Warning: Only available in development builds. - */ - function captureOwnerStack(): string | null; - type Reference = object; type TaintableUniqueValue = string | bigint | ArrayBufferView; function experimental_taintUniqueValue( diff --git a/types/react/test/canary.tsx b/types/react/test/canary.tsx index 117711db251c7e..40f907f8967171 100644 --- a/types/react/test/canary.tsx +++ b/types/react/test/canary.tsx @@ -25,3 +25,8 @@ function useCacheTest() { refresh(() => "refresh"); } } + +function ownerStacks() { + // $ExpectType string | null + const ownerStack = React.captureOwnerStack(); +} diff --git a/types/react/test/experimental.tsx b/types/react/test/experimental.tsx index 1a893b3e9711c1..8b6fdfe282aa37 100644 --- a/types/react/test/experimental.tsx +++ b/types/react/test/experimental.tsx @@ -43,11 +43,6 @@ function suspenseTest() { B ; -function ownerStacks() { - // $ExpectType string | null - const ownerStack = React.captureOwnerStack(); -} - function useEvent() { // Implicit any // @ts-expect-error diff --git a/types/react/ts5.0/canary.d.ts b/types/react/ts5.0/canary.d.ts index 9215a16bb87bab..3884df9d9a683d 100644 --- a/types/react/ts5.0/canary.d.ts +++ b/types/react/ts5.0/canary.d.ts @@ -32,4 +32,11 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export function unstable_useCacheRefresh(): () => void; + + /** + * Warning: Only available in development builds. + * + * @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs} + */ + function captureOwnerStack(): string | null; } diff --git a/types/react/ts5.0/experimental.d.ts b/types/react/ts5.0/experimental.d.ts index 006af56481dbdc..1a7f130f42c1b9 100644 --- a/types/react/ts5.0/experimental.d.ts +++ b/types/react/ts5.0/experimental.d.ts @@ -109,11 +109,6 @@ declare module "." { // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type export function experimental_useEffectEvent(event: T): T; - /** - * Warning: Only available in development builds. - */ - function captureOwnerStack(): string | null; - type Reference = object; type TaintableUniqueValue = string | bigint | ArrayBufferView; function experimental_taintUniqueValue( diff --git a/types/react/ts5.0/test/canary.tsx b/types/react/ts5.0/test/canary.tsx index 117711db251c7e..40f907f8967171 100644 --- a/types/react/ts5.0/test/canary.tsx +++ b/types/react/ts5.0/test/canary.tsx @@ -25,3 +25,8 @@ function useCacheTest() { refresh(() => "refresh"); } } + +function ownerStacks() { + // $ExpectType string | null + const ownerStack = React.captureOwnerStack(); +} diff --git a/types/react/ts5.0/test/experimental.tsx b/types/react/ts5.0/test/experimental.tsx index e7739ec60113ca..d03aa35f9a3ddc 100644 --- a/types/react/ts5.0/test/experimental.tsx +++ b/types/react/ts5.0/test/experimental.tsx @@ -43,11 +43,6 @@ function suspenseTest() { B ; -function ownerStacks() { - // $ExpectType string | null - const ownerStack = React.captureOwnerStack(); -} - function useEvent() { // Implicit any // @ts-expect-error