I have created an empty react-native
project but using type-script (like react-native init MyApp --template typescript
), then installed on that react-navigation-tabs
package, and the problem which I am facing is:
TS7016: Could not find a declaration file for module 'react-navigation-tabs'.
'.../node_modules/react-navigation-tabs/src/index.js' implicitly has an 'any' type.
Try `npm install @types/react-navigation-tabs` if it exists
or add a new declaration (.d.ts) file containing `declare module 'react-navigation-tabs';`
I did also try npm install --save-dev @types/react-navigation-tabs
, and since no such package did exist,
for now I did workaround it like suggested in another post.
But coming back to the question in the title, it is really painful, I mean the information that the IDE
needs to provide auto-completion are there, in the node_modules/react-navigation-tabs/src/index.js
file, like:
/* @flow */
/* eslint-disable import/no-commonjs */
module.exports = {
/**
* Navigators
*/
get createBottomTabNavigator() {
return require('./navigators/createBottomTabNavigator').default;
},
get createMaterialTopTabNavigator() {
return require('./navigators/createMaterialTopTabNavigator').default;
},
/**
* Views
*/
get BottomTabBar() {
return require('./views/BottomTabBar').default;
},
get MaterialTopTabBar() {
return require('./views/MaterialTopTabBar').default;
},
/**
* Utils
*/
get createTabNavigator() {
return require('./utils/createTabNavigator').default;
},
};
How can we make the IDE (e.g. VS Code
) show auto-completion using the data it can find in the existing node_modules/react-navigation-tabs/src/index.js
file ?
Edit: Also, created a request/question on github.