Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
When importing workspace, in my example it is in shared/components/Header.js, when typing at the end 'export default' it says 'type any' error

I an using yarn workspaces, and i have 3 packages: app, electron app using react, and shared for all the common stuff. When importing shared in the app or electron, it says that error in vscode: error

i dont know what to do :/ i tried everything. and the files arent ts, but js.

import { View, StyleSheet, Text } from 'react-native';
import Header from 'shared/components/Header';

//const socket = new Socket("192.168.1.146", 8080, "http");

(async () => {
  //await socket.connect();
})();

const styles = StyleSheet.create({
  screenContainer: {
    flex: 1
  },
  text: {
    fontSize: 20,
    color: 'cornflowerblue',
    marginTop: 50,
    alignSelf: 'center'
  }
});

const App = () => {
  /*useEffect(() => {
    if (socket.getSocket() != undefined && socket.getSocket().connected) {
      socket.getSocket().disconnect();
    }
  });*/
  return (
    <View styles={styles.screenContainer}>
      <Header />
      <Text style={styles.text}>I'm a React Native component</Text>
    </View>
  );
};

export default App;
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  header: {
    paddingTop: 50,
    backgroundColor: 'red'
  },
  headerText: {
    fontSize: 22,
    color: 'white',
    fontWeight: 'bold',
    paddingHorizontal: 10
  }
});

const Header = () => {
  return (
    <View style={styles.header}>
      <Text style={styles.headerText}>I'm a shared component.</Text>
    </View>
  );
};

export default Header;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

create fallback.d.ts with content:

declare module '*';

And include it in your tsconfig.json https://www.typescriptlang.org/tsconfig#include (path to d.ts file relative to tsconfig.json path)

{
   "include": ["./fallback.d.ts", ...],
    ...
}

This will allow you to import from js files.

But imho better would be to convert Header.js file to typescript

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!