Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated schemda.d.ts is invalid if you have a kebab-case named table #132

Open
atomanyih opened this issue Nov 3, 2022 · 2 comments
Open

Comments

@atomanyih
Copy link

atomanyih commented Nov 3, 2022

Trying out zapatos on an existing codebase and ran into this problem.

If you have a table called kebab-name, it will generate something like this:

declare module 'zapatos/schema' {
  // ...etc
  export namespace kebab-name { // syntax error
    // ...etc...
  }

  export namespace public {  
    export type Table = kebab-name.Table // syntax error
    // ...etc...
  }
}

Now I know that kebab-case is not postgres convention, but unfortunately someone donked up and it is technically valid. I'm wondering if there's any way to work around this that isn't manually correcting the generated schema.d.ts

@jawj
Copy link
Owner

jawj commented Nov 8, 2022

Hmm, I fixed this for column names recently in #122. But I'm afraid I don't think there's any straightforward fix for tables, because IIRC TypeScript namespaces have to be valid JS identifiers.

@sonhanguyen
Copy link

IIRC TypeScript namespaces have to be valid JS identifiers.

We don't have to use the kebab-case, we can just convert it to PascalCase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants