Describe the bug
When I try to follow the getting started from the docs, I get the error:
Plugin typescript does not export a valid JS object with "plugin" function.
To Reproduce
overwrite: true
schema: "./schema.graphql"
documents: null
generates:
./types.ts:
plugins:
- "typescript"
type Query {
resultSet(searchText: String!): ResultSet
board(id: ID!): Board
}
type Mutation {
createBoard: Board
addPhotosToBoard(input: AddPhotosToBoardInput!): AddPhotosToBoardPayload
updateBoardLayout(input: UpdateBoardLayoutInput!): UpdateBoardLayoutPayload
}
type ResultSet {
photos: [Photo]!
}
type Photo {
id: ID!
owner: String!
secret: String!
server: Int!
farm: Int!
title: String!
ispublic: Int!
isfriend: Int!
isfamily: Int!
}
enum TileSize {
SMALL
MEDIUM
LARGE
}
type Tile {
photo: Photo!
size: TileSize!
}
type Board {
id: ID!
tiles: [Tile!]!
}
input AddPhotosToBoardInput {
id: ID!
photos: [PhotoInput!]!
}
input PhotoInput {
id: ID!
owner: String!
secret: String!
server: Int!
farm: Int!
title: String!
}
type AddPhotosToBoardPayload {
board: Board
}
input UpdateBoardLayoutInput {
id: ID!
tileChanges: [TileChange!]!
}
input TileChange {
id: ID!
size: TileSize
}
type UpdateBoardLayoutPayload {
board: Board
}
Expected behavior
Types should be generated.
Environment:
@graphql-codegen/...: 1.11.2This is related to #1703 which was closed without a solution.
@ashubham can you please provide a reproduction in codesandbox/repo? We couldn't reproduce this issue.
Please make sure you have @graphql-codegen/typescript installed.
Had the same issue, this was because the quick start section did not mention @graphql-codegen/typescript installation. I can contribute to the docs if you'd like.
@doronnac Thank, this could help. The current documentation is not focused in TypeScript because we support multiple platforms and environments, not only typescript.
The basic instruction is to install the plugins you are using under plugins: section.
Closing for now. @ashubham If you have a reproduction, please share with us and we'll re-open this issue.
Most helpful comment
Had the same issue, this was because the quick start section did not mention
@graphql-codegen/typescriptinstallation. I can contribute to the docs if you'd like.