Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing a non-react typescript package #46

Open
jackall3n opened this issue Apr 27, 2020 · 5 comments
Open

Importing a non-react typescript package #46

jackall3n opened this issue Apr 27, 2020 · 5 comments

Comments

@jackall3n
Copy link

Great repo.

Is it possible with the tools provided here to create a package with shared Typescript code that is not a React application, that can be imported into the React applications?

Examples of what this package might contain could be Types, Validation logic, etc.

@nloding
Copy link

nloding commented Apr 27, 2020

That's the entire purpose of a monorepo like this. Create a shared library and import it, the same way the components library is set up in this playground.

@F1LT3R
Copy link
Collaborator

F1LT3R commented Apr 29, 2020

Does someone want to set up an example of this? I'd be happy to merge that into this repo!

@jackall3n
Copy link
Author

jackall3n commented Apr 30, 2020

@F1LT3R that would be great if you can, thanks!

@F1LT3R
Copy link
Collaborator

F1LT3R commented May 1, 2020

Just to be clear, I don't use TypeScript. We'll need a TypeScript developer to provide an example of this.

@ali-master
Copy link

Hi there

I have a problem with this boilerplate that when I import a pure typescript class or interface, then the react project will return the below error.

../core/src/services/http/index.ts
  Line 14:8:  Parsing error: Unexpected token, expected "{"

  12 |  * @abstract
  13 |  */
> 14 | export abstract class APIService {
     |        ^
  15 |  protected httpService: AxiosInstance;
  16 | 
  17 |  constructor({ suffix, baseURL = window.location.origin }: Config) {

Live example of what I've created; repository

To see the error, run this command:

npm run start:renderer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants