Monday, 30 January 2023

exporting a javascript react class component into a typescript file

is there a way to export a javascript react class component into a typescript file? i have the following code

Login.js

class Login extends Component {

constructor(props) {
    super(props);
    this.usernameText = React.createRef();
    this.passwordText = React.createRef();
    this.urlText = React.createRef();
    this.keyPress = this.keyPress.bind(this);
  }

  .
  .   
  .
 }
 export default  Login;

index.ts

const Login = require("./uiManagement/jiraUI/Login/Login");
export {
 Login as JiraUiLogin 
}

in another project i did an npm import for the above to use the login component

 import { Component } from "react";
import { JiraUiLogin } from "infosysta-typescript-core";
class mLogin extends Component {
  render() {
    return (
      <JiraUiLogin />
    )
  }
};
export default mLogin

but i having the following error enter image description here



from exporting a javascript react class component into a typescript file

No comments:

Post a Comment