react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

Typescript errors

Open soumyamishra89 opened this issue 6 years ago • 10 comments

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,

soumyamishra89 avatar Jan 06 '20 13:01 soumyamishra89

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'.

byCedric avatar Jan 14 '20 16:01 byCedric

@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...

evanyholm avatar Jan 22 '20 16:01 evanyholm

fixed types in 2.1.2

computerjazz avatar Jan 24 '20 18:01 computerjazz

Updated to 2.1.2 and still getting 39 TSC errors

evanyholm avatar Jan 27 '20 10:01 evanyholm

@computerjazz are you running typescript compiler with --strict? You can make a tsconfig.json with tsc --init, then run tsc again

evanyholm avatar Jan 27 '20 13:01 evanyholm

gotcha, I addressed the exported types, not the ts errors -- working on it, stay tuned.

computerjazz avatar Jan 27 '20 18:01 computerjazz

Do you need help with it?

evanyholm avatar Jan 31 '20 06:01 evanyholm

Thanks, I think I have it all sorted out in 2.2.0 -- give it a shot and let me know?

computerjazz avatar Feb 01 '20 04:02 computerjazz

@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.

donth77 avatar Feb 03 '20 04:02 donth77

No errors anymore, gj!

evanyholm avatar Feb 06 '20 11:02 evanyholm