Skip to content

Commit bf7ece6

Browse files
authored
[react] Add unstable_Activity (DefinitelyTyped#72454)
1 parent 5e1ae85 commit bf7ece6

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

types/react/experimental.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,19 @@ declare module "." {
214214
export interface FragmentProps {
215215
ref?: Ref<FragmentInstance> | undefined;
216216
}
217+
218+
// @enableActivity
219+
export interface ActivityProps {
220+
/**
221+
* @default "visible"
222+
*/
223+
mode?:
224+
| "hidden"
225+
| "visible"
226+
| undefined;
227+
children: ReactNode;
228+
}
229+
230+
/** */
231+
export const unstable_Activity: ExoticComponent<ActivityProps>;
217232
}

types/react/test/experimental.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,20 @@ function fragmentRefTest() {
284284
<div />
285285
</React.Fragment>;
286286
}
287+
288+
// @enableActivity
289+
function activityTest() {
290+
const Activity = React.unstable_Activity;
291+
292+
<Activity children="peekaboo" />;
293+
<Activity children="peekaboo" mode={undefined} />;
294+
<Activity children="peekaboo" mode="visible" />;
295+
<Activity children="peekaboo" mode="hidden" />;
296+
// @ts-expect-error -- Forgot children
297+
<Activity />;
298+
<Activity
299+
children="peekaboo"
300+
// @ts-expect-error -- Unknown mode
301+
mode="not-a-mode"
302+
/>;
303+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,19 @@ declare module "." {
214214
export interface FragmentProps {
215215
ref?: Ref<FragmentInstance> | undefined;
216216
}
217+
218+
// @enableActivity
219+
export interface ActivityProps {
220+
/**
221+
* @default "visible"
222+
*/
223+
mode?:
224+
| "hidden"
225+
| "visible"
226+
| undefined;
227+
children: ReactNode;
228+
}
229+
230+
/** */
231+
export const unstable_Activity: ExoticComponent<ActivityProps>;
217232
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,20 @@ function fragmentRefTest() {
287287
<div />
288288
</React.Fragment>;
289289
}
290+
291+
// @enableActivity
292+
function activityTest() {
293+
const Activity = React.unstable_Activity;
294+
295+
<Activity children="peekaboo" />;
296+
<Activity children="peekaboo" mode={undefined} />;
297+
<Activity children="peekaboo" mode="visible" />;
298+
<Activity children="peekaboo" mode="hidden" />;
299+
// @ts-expect-error -- Forgot children
300+
<Activity />;
301+
<Activity
302+
children="peekaboo"
303+
// @ts-expect-error -- Unknown mode
304+
mode="not-a-mode"
305+
/>;
306+
}

0 commit comments

Comments
 (0)