The index.tsx file contains unresolved typescript error like not proper type definitions on certain methods.
Assigning null type to string, etc.
line numbers:
67,
230,
248,
249,
250,
251,
283,
284,
423,
441,
458,
466,
470,
471,
475,
476,
477,
478,
487,
494,
522,
534,
535,
538,
540,
541,
569,
575,
601,
638,
655,
674,
712,
730,
734,
741,
747,
753,
762,
778,
Same issue here. These are the exact typescript issues we encounter when validating our code with tsc --noEmit
node_modules/react-native-draggable-flatlist/index.tsx(280,21): error TS2345: Argument of type '{ activeKey: string; hoverComponent: React.ComponentType<{}>; }' is not assignable to parameter of type 'State | ((prevState: Readonly<State>, props: Readonly<Modify<VirtualizedListProps<T>, { autoscrollSpeed?: number; autoscrollThreshold?: number; ... 7 more ...; debug?: boolean; }>>) => State | Pick<...>) | Pick<...>'.
Type '{ activeKey: string; hoverComponent: React.ComponentType<{}>; }' is not assignable to type 'Pick<State, "activeKey" | "hoverComponent">'.
Types of property 'hoverComponent' are incompatible.
Type 'ComponentType<{}>' is not assignable to type 'Element'.
Type 'ComponentClass<{}, any>' is missing the following properties from type 'Element': type, props, key
node_modules/react-native-draggable-flatlist/index.tsx(429,28): error TS2345: Argument of type '{ initialized: Animated.Value<0>; currentIndex: Animated.Value<number>; size: Animated.Value<number>; offset: Animated.Value<number>; style: { ...; }; onLayout: () => Promise<...>; onUnmount: () => void; onCellTap: (...args: any[]) => void; measurements: { ...; }; }' is not assignable to parameter of type 'CellData'.
The types of 'style.transform' are incompatible between these types.
Type '{ [x: string]: AnimatedNode<number>; }[]' is not assignable to type '(PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 6 more ... | SkewYTransform)[]'.
Type '{ [x: string]: Animated.Node<number>; }' is not assignable to type 'PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 6 more ... | SkewYTransform'.
Property 'skewY' is missing in type '{ [x: string]: Animated.Node<number>; }' but required in type 'SkewYTransform'.
node_modules/react-native-draggable-flatlist/index.tsx(446,65): error TS2339: Property '_component' does not exist on type 'typeof View'.
node_modules/react-native-draggable-flatlist/index.tsx(454,19): error TS2339: Property '_component' does not exist on type 'typeof View'.
node_modules/react-native-draggable-flatlist/index.tsx(510,30): error TS2339: Property '_component' does not exist on type 'DraggableFlatList<T>'.
node_modules/react-native-draggable-flatlist/index.tsx(724,9): error TS2769: No overload matches this call.
Overload 1 of 2, '(props: Readonly<RowItemProps>): RowItem', gave the following error.
Type '(hoverComponent: React.ComponentType<{}>, activeKey: string) => void' is not assignable to type '(hoverComponent: Element, itemKey: string) => void'.
Types of parameters 'hoverComponent' and 'hoverComponent' are incompatible.
Type 'Element' is not assignable to type 'ComponentType<{}>'.
Type 'Element' is not assignable to type 'FunctionComponent<{}>'.
Type 'Element' provides no match for the signature '(props: { children?: ReactNode; }, context?: any): ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)>) | (new (props: any) => Component<...>)>'.
Overload 2 of 2, '(props: RowItemProps, context?: any): RowItem', gave the following error.
Type '(hoverComponent: React.ComponentType<{}>, activeKey: string) => void' is not assignable to type '(hoverComponent: Element, itemKey: string) => void'.
node_modules/react-native-draggable-flatlist/index.tsx(759,15): error TS2769: No overload matches this call.
Overload 1 of 2, '(props: Readonly<AnimateProps<ViewStyle, ViewProps>>): View', gave the following error.
Type 'RefObject<typeof View>' is not assignable to type 'LegacyRef<View>'.
Type 'RefObject<typeof View>' is not assignable to type 'RefObject<View>'.
Type 'typeof View' is missing the following properties from type 'View': getNode, context, setState, forceUpdate, and 4 more.
Overload 2 of 2, '(props: AnimateProps<ViewStyle, ViewProps>, context?: any): View', gave the following error.
Type 'RefObject<typeof View>' is not assignable to type 'LegacyRef<View>'.
Type 'RefObject<typeof View>' is not assignable to type 'RefObject<View>'.
node_modules/react-native-draggable-flatlist/procs.tsx(29,16): error TS2322: Type '(...params: AnimatedValue<number>[]) => Adaptable<number>' is not assignable to type '(...args: Adaptable<number>[]) => AnimatedNode<number>'.
Type 'Adaptable<number>' is not assignable to type 'AnimatedNode<number>'.
Type 'number' is not assignable to type 'AnimatedNode<number>'.
node_modules/react-native-draggable-flatlist/procs.tsx(232,9): error TS2345: Argument of type '{ finished: Animated.Value<number>; velocity: Animated.Value<number>; position: Animated.Value<number>; time: Animated.Value<number>; prevPosition: Animated.Value<...>; }' is not assignable to parameter of type 'PhysicsAnimationState'.
Object literal may only specify known properties, and 'prevPosition' does not exist in type 'PhysicsAnimationState'.
@computerjazz are you planning to fix all of the TypeScript errors? Just weighting my options here, to ignore, fork and fix them by myself or wait for a commit...
fixed types in 2.1.2
Updated to 2.1.2 and still getting 39 TSC errors
@computerjazz are you running typescript compiler with --strict? You can make a tsconfig.json with tsc --init, then run tsc again
gotcha, I addressed the exported types, not the ts errors -- working on it, stay tuned.
Do you need help with it?
Thanks, I think I have it all sorted out in 2.2.0 -- give it a shot and let me know?
@computerjazz I've been working with your component recently and have been encountering the same TS errors. So far this issue seems fixed in 2.2.0. Thanks.
No errors anymore, gj!
Most helpful comment
fixed types in 2.1.2