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

import relations as ts types to fix circular imports #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhyek
Copy link

@rhyek rhyek commented Jun 3, 2024

Fixes #60

Proposed Changes

  • Import generated relation types both as classes for use in ApiProperty decorators, but also as TypeScript types for use as the field type definition to avoid circular import errors when building the project.

Example of the result:

import { users, type users as usersAsType } from './users';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class identities {
  @ApiProperty({ type: () => users })
  users: usersAsType;
}

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

Successfully merging this pull request may close these issues.

Cannot access 'User' before initialization
1 participant