Getting "undefined: undefined" when using enums
See original GitHub issueI have a type-graphql class like this
import { registerEnumType } from 'type-graphql';
enum Color {
black = 'black',
white = 'white',
gray = 'gray',
orange = 'orange',
purple = 'purple',
red = 'red',
yellow = 'yellow',
green = 'green',
blue = 'blue',
}
registerEnumType(Color, {
name: 'Color', // this one is mandatory
description: 'Various Colors', // this one is optional
});
@ObjectType()
class Grid {
// ...
@Field(() => [[Color]], { nullable: 'items' })
colors?: (Color | null)[][];
// ...
}
@Resolver(Sudoku)
export class GridResolver {
@Query(() => [Grid])
getGrids(): Grid[] {
// return array of grids from db
}
}
And I can successfully query it with the graphIQL playground. However when I query it with houdini like this
<script lang="ts">
import { query, graphql, GetGrids } from '$houdini';
const { data } = query<GetGrids>(graphql`
query GetGrids {
getGrids {
colors
}
}
`);
console.log("data", $data);
</script>
I get
data {
getGrids: [
// ...
{ undefined: undefined }, // should be colors: ["green", ...]
// ...
]
}
instead of the colors.
Am I doing something wrong?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Typescript runtime error: cannot read property of undefined ...
I want to import and use the enum in another class as such: import { RESTConfig, RESTMethod } from './RESTConfig'; class Pipelines ...
Read more >Enum variables become undefined if changed to environment ...
Enums become undefined when input type is changed to an environment variable and then changed back to the static variable. When the variable...
Read more >Enumeration declaration - cppreference.com
An enumeration is (re)declared using the following syntax: ... is not fixed and the source value is out of range, the behavior is...
Read more >Some enums from a C++ namespace have undefined values ...
When I get undefined it is usually because I misspelled an enum or property. Does the above code actually reproduce the problem? Can...
Read more >Guide - Enum TypeScript & JavaScript Tutorial
Without Enums in JavaScript, the coders came up with unique solutions. We can condense all of ... During runtime, it will just return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks man!
This should be fixed in
0.10.7