edgedb / edgedb-js

The official TypeScript/JS client library and query builder for EdgeDB
https://edgedb.com
Apache License 2.0
508 stars 65 forks source link

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

Open ssendev opened 11 months ago

ssendev commented 11 months ago

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?

haikyuu commented 11 months ago

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