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

Transform React Native export file in Typescript

$
0
0

How can I translate this .js file into a Typescript one?

import * as Colors from './colors';import * as Spacing from './spacing';import * as Typography from './typography';import * as Mixins from './mixins';export { Typography, Spacing, Colors, Mixins };

Thank you

Edit 1:I'm trying to fix the folowing error:

Cannot find module '_styles' or its corresponding type declarations.

When trying to import a file in another file

import {Colors,Typography,Mixins} from '_styles';

It works, but shows the above warning.I have a setup that allow my to import the file without the complete path that works well but with typescript, it shows a warning.

Edit 2:

I have the following setup in .babelrc

    {"plugins": [    ["module-resolver",      {"cwd": "babelrc","root": ["./src"],"extensions": [".js", ".ios.js", ".android.js", ".ts", ".tsx", ".json"],"alias": {"_assets": "./src/assets","_components": "./src/components","_atoms": "./src/components/atoms","_molecules": "./src/components/molecules","_organisms": "./src/components/organisms","_navigations": "./src/navigations","_scenes": "./src/scenes","_services": "./src/services","_styles": "./src/styles","_utils": "./src/utils","_i18n": "./src/i18n"        }      }    ]  ]}

Viewing all articles
Browse latest Browse all 6213

Trending Articles



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