test(domains:(string|seq[string])) =
var domainseq:seq[string]
if typeof(domains) is string:
domainseq = @[domains]
else:
domainseq = @["abc"]
echo domainseq
test(@["xxx.com"])
Error: type mismatch: got 'seq[seq[string]]' for '@[domains]' but expected 'seq[string]'
proc test(domains: seq[string]) = # 1
echo domains
proc test(domain: string) = test(@[domain]) # 2
test @["xxx.com"] # calls 1
test "yyy.com" # calls 2
You can use overloading here. But it is a bad idea for a beginner. If you deal with a list of domains, offer the seq[string] variant and use that.