react-workspaces / react-workspaces-playground

⚛️ 🐈 Zero Config Create-React-App Monorepos with Yarn Workspaces, Lerna and React Storybook.
https://react-workspaces.github.io/react-workspaces-playground/
764 stars 128 forks source link

Importing a non-react typescript package #46

Open jackall3n opened 4 years ago

jackall3n commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

jackall3n commented 4 years ago

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

F1LT3R commented 4 years ago

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

ali-master commented 4 years ago

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