Reputation: 1
I'm working on an Angular-Nest project using a monorepo structure with multiple workspaces. I am trying to export an enum from the types workspace and use it in the server workspace, but I'm encountering an error.
Here is the structure of my project:
my-monorepo/
├── client/
├── server/
│ ├── dist/
│ ├── src/
│ │ ├── auth/
│ │ ├── booking/
│ │ ├── common/
│ │ ├── listing/
│ │ ├── user/
│ │ ├── app.module.ts
│ │ ├── config.schema.ts
│ │ ├── main.ts
│ │ └── transform.interceptor.ts
│ ├── test/
│ ├── .eslint.rc.js
│ ├── .gitignore
│ ├── .prettierrc
│ ├── gcpServiceAccountKey.json
│ ├── nest-cli.json
│ ├── package.json
│ ├── package-lock.json
│ ├── README.md
│ ├── tsconfig.build.json
│ ├── tsconfig.json
├── types/
│ ├── src/
│ │ ├── listing/
│ │ │ ├── index.ts
│ │ │ ├── listing.interface.ts
│ │ │ ├── listing-image.interface.ts
│ │ ├── booking.interface.ts
│ │ ├── index.ts
│ │ ├── user.interface.ts
│ ├── package.json
In the types workspace, I have defined an enum in src/listing/index.ts:
// types/src/listing/index.ts
export enum ListingImageCategory {
EXTERIOR = 'exterior',
BEDROOM = 'bedroom',
BATHROOM = 'bathroom',
COMMON_AREA = 'common_area',
}
The package.json of the types workspace looks like this:
{
"name": "@my-org/types",
"version": "1.0.0",
"main": "src/index.ts",
"type": "module"
}
In the server workspace, I am trying to import the enum like this:
// server/src/listing/dto/add-listing-image.dto.ts
import {
IsEnum,
IsOptional,
IsString,
MaxLength,
MinLength,
} from 'class-validator';
import { ListingImageCategory } from '../entities/listing-image.entity';
export class AddListingImageDto {
@IsString()
@IsOptional()
@MinLength(4)
@MaxLength(50)
label?: string;
@IsString()
@IsEnum(ListingImageCategory)
category: ListingImageCategory;
}
But I am getting the following error:
export * from './user.interface'
^^^^^^
invalid export
I've ensured that both workspaces are installed and linked correctly. Can someone help me figure out what might be going wrong?
Here is a link to my GitHub repository: https://github.com/Soumajit2004/angular-nest-airbnb-clone/
Thanks in advance!
everything is explained in question
Upvotes: 0
Views: 26