edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Add `generate interfaces --no-namespaces` that creates a file for each module

Open ssendev opened this issue 2 years ago • 1 comments

Add a mode to generate interfaces that produces a modulename.ts file instead of a namespace for each EdgeDB module

before:

import { Movie, example } from 'interfaces.ts'

type Watched = {
  movie: Movie,
  person: example.User
}

after:

import { Movie } from 'interfaces/default.ts'
// could also keep the name. or always generate both
// and have an identical to today `interfaces.ts` that reexports the esmodules
import { User } from 'interfaces/example.ts'

type Watched = {
  movie: Movie,
  person: User
}

why?

  • i like to write User instead of example.User
  • better performance (if modules don't reference all other modules)

ssendev avatar Oct 12 '23 13:10 ssendev

I think it would be nice to expose a way for users to create custom generators. (introspectionResult) => custom logic

haikyuu avatar Oct 13 '23 08:10 haikyuu