Skip to content

Commit

Permalink
[react] Move captureOwnerStack to Canary build (DefinitelyTyped#71731)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Feb 16, 2025
1 parent b4a1c75 commit d6556b5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
7 changes: 7 additions & 0 deletions types/react/canary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
5 changes: 0 additions & 5 deletions types/react/experimental.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ declare module "." {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function experimental_useEffectEvent<T extends Function>(event: T): T;

/**
* Warning: Only available in development builds.
*/
function captureOwnerStack(): string | null;

type Reference = object;
type TaintableUniqueValue = string | bigint | ArrayBufferView;
function experimental_taintUniqueValue(
Expand Down
5 changes: 5 additions & 0 deletions types/react/test/canary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ function useCacheTest() {
refresh(() => "refresh");
}
}

function ownerStacks() {
// $ExpectType string | null
const ownerStack = React.captureOwnerStack();
}
5 changes: 0 additions & 5 deletions types/react/test/experimental.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ function suspenseTest() {
<React.Suspense fallback="Loading">B</React.Suspense>
</React.unstable_SuspenseList>;

function ownerStacks() {
// $ExpectType string | null
const ownerStack = React.captureOwnerStack();
}

function useEvent() {
// Implicit any
// @ts-expect-error
Expand Down
7 changes: 7 additions & 0 deletions types/react/ts5.0/canary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
5 changes: 0 additions & 5 deletions types/react/ts5.0/experimental.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ declare module "." {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function experimental_useEffectEvent<T extends Function>(event: T): T;

/**
* Warning: Only available in development builds.
*/
function captureOwnerStack(): string | null;

type Reference = object;
type TaintableUniqueValue = string | bigint | ArrayBufferView;
function experimental_taintUniqueValue(
Expand Down
5 changes: 5 additions & 0 deletions types/react/ts5.0/test/canary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ function useCacheTest() {
refresh(() => "refresh");
}
}

function ownerStacks() {
// $ExpectType string | null
const ownerStack = React.captureOwnerStack();
}
5 changes: 0 additions & 5 deletions types/react/ts5.0/test/experimental.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ function suspenseTest() {
<React.Suspense fallback="Loading">B</React.Suspense>
</React.unstable_SuspenseList>;

function ownerStacks() {
// $ExpectType string | null
const ownerStack = React.captureOwnerStack();
}

function useEvent() {
// Implicit any
// @ts-expect-error
Expand Down

0 comments on commit d6556b5

Please sign in to comment.