'no-use-before-define typescript interfaces

I have 2 typescript interfaces that have a member that is of the type of the other interface (circular reference). My linter complains that I cannot use an interface before I defined it. However, I have to define one first.

interface Foo {
  // error, Bar was used before it was defined
  bar: Bar
}

interface Bar {
  foo: Foo
}

I am very much aware that I can just disable the linter rule for the line but what is the proper way of solving it?



Solution 1:[1]

Try renaming file extension to d.ts.

I met the same problem and solved it after referring to this reply.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Richex