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

React Native Expo cannot find type declarations

$
0
0

I am using React Native with Expo framework with Typescript and my tsconfig.json have an include declaration with the path to the file with type declarations for images

//images.d.tsdeclare module "*.jpg";declare module "*.jpeg";declare module "*.svg";declare module "*.gif";declare module "*.png";
//tsconfig.json{"extends": "expo/tsconfig.base","include": ["assets/*", "components/*", "types/*"],"compilerOptions": {"strict": true  }}
//App.tsximport { StatusBar } from "expo-status-bar";import { StyleSheet, Text, View, Image } from "react-native";import { HealthCheckForm } from "./components";import hero from "./assets/hero-health-check.png";const App: React.FC = () => {  return (<View style={styles.container}><StatusBar style="auto" /><View style={styles.wrapper}><Image source={hero} style={styles.hero} /><Text style={styles.welcomeText}>Health Check App</Text><HealthCheckForm /></View></View>  );};export default App;const styles = StyleSheet.create({  container: {    flex: 1,    backgroundColor: "#fff",    alignItems: "center",    justifyContent: "flex-start",  },  wrapper: {    backgroundColor: "#75caee",    width: "100%",    height: "100%",    maxWidth: 625,    alignItems: "center",  },  hero: {    height: "50%",    width: "100%",  },  welcomeText: {    fontSize: 32,    marginVertical: 10,  },});

In my other React Typescript projects, it was sufficient to point tsconfig.json to the type declarations, tell me please what I am missing. Thanks


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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