Skip to content

Commit 217c865

Browse files
committed
chore: patch CSSMotionList ts def
1 parent 194cb5d commit 217c865

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/CSSMotionList.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint react/prop-types: 0 */
22
import * as React from 'react';
3-
import OriginCSSMotion, { CSSMotionProps } from './CSSMotion';
3+
import OriginCSSMotion from './CSSMotion';
4+
import type { CSSMotionProps } from './CSSMotion';
45
import { supportTransition } from './util/motion';
56
import {
67
STATUS_ADD,
@@ -9,8 +10,8 @@ import {
910
STATUS_REMOVED,
1011
diffKeys,
1112
parseKeys,
12-
KeyObject,
1313
} from './util/diff';
14+
import type { KeyObject } from './util/diff';
1415

1516
const MOTION_PROP_NAMES = [
1617
'eventProps',
@@ -36,7 +37,8 @@ const MOTION_PROP_NAMES = [
3637
];
3738

3839
export interface CSSMotionListProps
39-
extends Omit<CSSMotionProps, 'onVisibleChanged'> {
40+
extends Omit<CSSMotionProps, 'onVisibleChanged'>,
41+
Omit<React.HTMLAttributes<any>, 'children'> {
4042
keys: (React.Key | { key: React.Key; [name: string]: any })[];
4143
component?: string | React.ComponentType | false;
4244

@@ -77,7 +79,7 @@ export function genCSSMotionList(
7779
const mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);
7880

7981
return {
80-
keyEntities: mixedKeyEntities.filter((entity) => {
82+
keyEntities: mixedKeyEntities.filter(entity => {
8183
const prevEntity = keyEntities.find(({ key }) => entity.key === key);
8284

8385
// Remove if already mark as removed
@@ -95,7 +97,7 @@ export function genCSSMotionList(
9597

9698
removeKey = (removeKey: React.Key) => {
9799
this.setState(({ keyEntities }) => ({
98-
keyEntities: keyEntities.map((entity) => {
100+
keyEntities: keyEntities.map(entity => {
99101
if (entity.key !== removeKey) return entity;
100102
return {
101103
...entity,
@@ -117,7 +119,7 @@ export function genCSSMotionList(
117119
const Component = component || React.Fragment;
118120

119121
const motionProps: CSSMotionProps = {};
120-
MOTION_PROP_NAMES.forEach((prop) => {
122+
MOTION_PROP_NAMES.forEach(prop => {
121123
motionProps[prop] = restProps[prop];
122124
delete restProps[prop];
123125
});
@@ -133,7 +135,7 @@ export function genCSSMotionList(
133135
key={eventProps.key}
134136
visible={visible}
135137
eventProps={eventProps}
136-
onVisibleChanged={(changedVisible) => {
138+
onVisibleChanged={changedVisible => {
137139
onVisibleChanged?.(changedVisible, { key: eventProps.key });
138140

139141
if (!changedVisible) {

0 commit comments

Comments
 (0)