Strange, it should work but it doesn't playground
type O* = object
using tself: type[O]
proc init*(tself, v: int): O =
discard
proc init*(tself, v: string): O =
O.init(1)
Error
/usercode/in.nim(9, 4) Error: type mismatch: got <type O, int literal(1)>
but expected one of:
proc init(tself, v: int): O
first type mismatch at position: 1
required type for tself: int
but expression 'O' is of type: type O
proc init(tself, v: string): O
first type mismatch at position: 1
required type for tself: string
but expression 'O' is of type: type O
expression: init(O, 1)
You need to use the semicolon to separate tself from the rest since otherwise it means that you want type[O], v: int which is incorrect.
type O* = object
using tself: type[O]
proc init*(tself; v: int): O =
discard
proc init*(tself; v: string): O =
O.init(1)