cometkim / gatsby-plugin-typegen

Let's give developers using GatsbyJS better DX with extreme type-safety
https://www.gatsbyjs.org/packages/gatsby-plugin-typegen/
MIT License
204 stars 25 forks source link

Fix wrong namespaces in some type definitions when using flow #155

Closed ofqwx closed 3 years ago

ofqwx commented 3 years ago

For some reason one of the codegen plugins is not happy with $ type prefix, causing some types references to be generated without $ in the prefix therefore the type is undefined. Example in my generated file:

// Type is declared with $ prefix
declare type $ContentJsonFieldsEnum = $Values<typeof $ContentJsonFieldsEnumValues>;

declare type $ContentJsonSortInput = {|
  fields?: ?Array<?ContentJsonFieldsEnum>, // Type is referenced without prefix
  order?: ?Array<?$SortOrderEnum>,
|};

removing $ from typePrefix seems to solve the issue.

ofqwx commented 3 years ago

@cometkim Closed since updating @graphql-codegen/flow to v1.18.5 fixed the issue.