Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to check type in react-native?

$
0
0

I have a problem, already solved it, but make me confuse about modules.

I tried to import an Animated in my component.

import { Animated, Easing } from 'react-native';

and then, I tried to find Its type (flow), I found that answer in.Flow types for react-native's Animated library (Thank you).

import type AnimatedValue from 'react-native/Libraries/Animated/src/nodes/AnimatedValue';

The question is.When I open Animated in import { Animated, Easing } from 'react-native';(right click, then I go to type definition with "Visual code"), Why it doesn't go to Its module, but to this path? (Library/Caches)enter image description hereI tried to find out this file (index.d.ts) in "react-native" modules, but I cant find it. Why?

Then I try to read index.d.ts, to find out type for Animated.Value.

export namespace Animated {    type AnimatedValue = Value;    type AnimatedValueXY = ValueXY;export class Value extends AnimatedWithChildren {

Horraay, I got Animated.Value is a class, and Its type is an AnimatedValue. Then as usual to find Its path, I right click, then I go to type definition with "Visual code", but I found nothing.

So, how can this import type AnimatedValue from 'react-native/Libraries/Animated/src/nodes/AnimatedValue relate to type AnimatedValue = Value; in index.d.ts?

"react-native": "0.63.2",


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>