Actually I think there is a difference between how types and procs are treated, I don't know if this is intentional.
This compiles:
types.nim
type Foo* = distinct int
proc toFoo*(x: int): Foo =
Foo(x)
lib.nim
import types
proc Bar*[T](input:T) =
let x = 5.toFoo
echo $x.int
echo input
bug.nim
import lib
proc bug() =
Bar("HEllo World")
bug()
