Ok, for 2 years I have been developing a GraphQL Node.js Apollo API in typescript, and there is one thing our team never managed to get up and running: How do we get "Go to Definition" in our .ts
files, containing the Grahpql Schema?
Our schema is defined in multiple .ts
files, and it's very frustrating having to look through many files when needing to lookup a type definition, input, etc.
We are all using VS Code, and I hoped I could obtain this with the Apollo Graphql extension. However this only seems to work for client projects?
Example of code structure
// file 1, inputs.ts
export const inputs = gql`
input: FancyInput {
fancyName: String!
}
`;
// file 2, mutations.ts
export const mutations = gql`
// HOW do we get "Go to Definition" when right clicking the 'FancyInput'?
fancyMutation(input: FancyInput): Boolean!
`;
// file 3, apollo-server-setup
const { inputs } = from './inputs';
const { mutations } = from './mutations';
const server = new ApolloServer({
typeDefs: [
inputs,
mutations
]
})
In the beginning, this was not a big problem, but now it's super frustrating because the project is rather big today with 30+ schema files.