E016: Cyclic Type Import
Severity: Warning
type import of `./b.nix` is cyclic — it leads back to this file; the imported type is unconstrained
A type-level import in a doc comment — import("./b.nix").T or typeof import("./b.nix") — needs the other file’s types, but inferring that file leads back to the file being checked (directly, or through further imports). Tix breaks the cycle by treating the imported type as unconstrained (?) at the point where it loops.
Common causes
- Two files whose annotations reference each other’s exported types.
- A
type T = typeof value;export whosevalueimports a file that annotates something withimport("<this file>").T.
How to fix
- Move the shared type into a
.tixstub, or into an inlinetypealias in one of the files, so neither file needs the other’s inference to know it. - Break the cycle by annotating one side with an explicit type instead of
typeof.