question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

enum type error when snake case

See original GitHub issue

I’m using v0.10.7 and having a issue with the casing in generated typescript types not matching.

schema:

enum color_name {
  blue
  red
  white
}

type Query {
  hello: color_name
}

generated types:

export interface Query {
  hello?: ColorName | null;    ### <- pascal case
}

export enum color_name {    ### <- snake case
  yello = "yello",
  black = "black",
  red = "red"
}

export namespace QueryResolvers {
  export interface Resolvers<Context = any> {
    hello?: HelloResolver<ColorName | null, any, Context>;    ### <- pascal case
  }

  export type HelloResolver<
    R = ColorName | null,    #### <- pascal case
    Parent = any,
    Context = any
  > = Resolver<R, Parent, Context>;
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dotansimhacommented, Aug 21, 2018

Done! 0.11 is available now. @shinyaohira

0reactions
shinyaohiracommented, Feb 9, 2019

@dotansimha I opened the issue #1297 . thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

String enums in typescript - javascript - Stack Overflow
TypeScript enums are number based. You can use string literals with union types to mock a string based enum as in the CardinalDirection ......
Read more >
Google C++ Style Guide
This section lists the main dos and don'ts you should follow when writing a class. Doing Work in Constructors. Avoid virtual method calls...
Read more >
Safer Enums in Go - Three Dots Labs
Use camelCase , snake_case , or kebab-case . Slug are especially useful for error codes. An error response like {"error": "user-not-found"} ...
Read more >
Case in convert_case - Rust - Docs.rs
Defines the type of casing a string can be. ... Enum convert_case::Case ... A camel case identifier myVarName is split where a lowercase...
Read more >
Camel case vs. snake case: What's the difference?
Camel case and snake case are popular naming conventions, but they serve very ... and upper camel case for reference types such as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found