Closed loeffel-io closed 2 years ago
Hm, I can't see a problem in typescriptify here.
Something like this works without problems:
package main
import (
"fmt"
testpackage "github.com/tkrajina/typescriptify-golang-structs/test-package"
"github.com/tkrajina/typescriptify-golang-structs/typescriptify"
)
func main() {
t := typescriptify.New()
t.Add(testpackage.Aaaa{})
err := t.ConvertToFile("test.ts")
if err != nil {
panic(err.Error())
}
}
while generating the main via the cli the testpackage
part of testpackage "github.com/tkrajina/typescriptify-golang-structs/test-package"
will not be added (the package of the ranked-model directory is model
)
Ah... I thought this was your code, not the code generated. Maybe a bit more of context (for example how to actually reproduce the error) would have helped initially.
Anyway. Pushed a change in dev
. It generates code like this:
package main
import (
"fmt"
m "github.com/tkrajina/typescriptify-golang-structs/example/example-models"
"github.com/tkrajina/typescriptify-golang-structs/typescriptify"
)
func main() {
t := typescriptify.New()
t.CreateInterface = true
t.BackupDir=""
t.Add(m.Address{})
t.Add(m.PersonalInfo{})
t.Add(m.Person{})
err := t.ConvertToFile("tmp_interfaces.ts")
if err != nil {
panic(err.Error())
}
fmt.Println("OK")
}
Let me know if it works for you.