Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Circular dependency detected #45

Open
mdbetancourt opened this issue Dec 9, 2021 · 2 comments
Open

Circular dependency detected #45

mdbetancourt opened this issue Dec 9, 2021 · 2 comments

Comments

@mdbetancourt
Copy link

mdbetancourt commented Dec 9, 2021

i have two files

// user.model.ts
import { Action } from 'action.model.ts'
export const User = () => ({
   actions: array(() => Action)
})
// action.model.ts
import { User } from 'user.model.ts'
export const Action = () => ({
   user: () => User
})

but throw Circular dependency detected

@Akryum
Copy link
Owner

Akryum commented Dec 9, 2021

Because there is a circular dependency between the two files?

Try using import type instead of import

@mdbetancourt
Copy link
Author

mdbetancourt commented Dec 10, 2021

:( i wanna use this test runner for a server side code with relations (loopback) and i need the metadata provided at runtime (the circular dependency is solved with lazy functions) this way peeky is unusable for me

// customer.ts
class Customer extends Entity {
  // constructor, properties, etc.
  @hasMany(() => Order, {keyTo: 'customerId'})
  orders?: Order[];
}
// order.ts
@model()
export class Order extends Entity {
  @belongsTo(() => Customer)
  customerId: number;
}

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

No branches or pull requests

2 participants