Skip to content

Commit d6556b5

Browse files
authored
[react] Move captureOwnerStack to Canary build (DefinitelyTyped#71731)
1 parent b4a1c75 commit d6556b5

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

types/react/canary.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
3232

3333
declare module "." {
3434
export function unstable_useCacheRefresh(): () => void;
35+
36+
/**
37+
* Warning: Only available in development builds.
38+
*
39+
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
40+
*/
41+
function captureOwnerStack(): string | null;
3542
}

types/react/experimental.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ declare module "." {
109109
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
110110
export function experimental_useEffectEvent<T extends Function>(event: T): T;
111111

112-
/**
113-
* Warning: Only available in development builds.
114-
*/
115-
function captureOwnerStack(): string | null;
116-
117112
type Reference = object;
118113
type TaintableUniqueValue = string | bigint | ArrayBufferView;
119114
function experimental_taintUniqueValue(

types/react/test/canary.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ function useCacheTest() {
2525
refresh(() => "refresh");
2626
}
2727
}
28+
29+
function ownerStacks() {
30+
// $ExpectType string | null
31+
const ownerStack = React.captureOwnerStack();
32+
}

types/react/test/experimental.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ function suspenseTest() {
4343
<React.Suspense fallback="Loading">B</React.Suspense>
4444
</React.unstable_SuspenseList>;
4545

46-
function ownerStacks() {
47-
// $ExpectType string | null
48-
const ownerStack = React.captureOwnerStack();
49-
}
50-
5146
function useEvent() {
5247
// Implicit any
5348
// @ts-expect-error

types/react/ts5.0/canary.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
3232

3333
declare module "." {
3434
export function unstable_useCacheRefresh(): () => void;
35+
36+
/**
37+
* Warning: Only available in development builds.
38+
*
39+
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
40+
*/
41+
function captureOwnerStack(): string | null;
3542
}

types/react/ts5.0/experimental.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ declare module "." {
109109
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
110110
export function experimental_useEffectEvent<T extends Function>(event: T): T;
111111

112-
/**
113-
* Warning: Only available in development builds.
114-
*/
115-
function captureOwnerStack(): string | null;
116-
117112
type Reference = object;
118113
type TaintableUniqueValue = string | bigint | ArrayBufferView;
119114
function experimental_taintUniqueValue(

types/react/ts5.0/test/canary.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ function useCacheTest() {
2525
refresh(() => "refresh");
2626
}
2727
}
28+
29+
function ownerStacks() {
30+
// $ExpectType string | null
31+
const ownerStack = React.captureOwnerStack();
32+
}

types/react/ts5.0/test/experimental.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ function suspenseTest() {
4343
<React.Suspense fallback="Loading">B</React.Suspense>
4444
</React.unstable_SuspenseList>;
4545

46-
function ownerStacks() {
47-
// $ExpectType string | null
48-
const ownerStack = React.captureOwnerStack();
49-
}
50-
5146
function useEvent() {
5247
// Implicit any
5348
// @ts-expect-error

0 commit comments

Comments
 (0)