ApolloServer 4 - Anticipated 0 Parameters but received 1 - Typescript Error Detected

Encountering a Typescript Error: Expected 0 Arguments But Received 1 When Instantiating ApolloServer Objects. The documentation specifies that it should only accept one parameter, and the code runs without errors so unsure why this warning is showing up from Typescript.

import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { schema } from "./api/schema";
import ContextValue from "./api/context";

const server = new ApolloServer({
  schema,
});

const { url } = await startStandaloneServer(server, {
  listen: { port: 4000 },
  context: async ({ req }) => new ContextValue({ req, server }),
});

console.log(`šŸš€  Server ready at: ${url}`);

Answer ā„–1

After conducting some research, I identified the root cause of this issue. It appears that there was a version mismatch between the TypeScript used in VSCode and the project itself. To resolve this, ensure that the version of TypeScript in VSCode matches the one used in the project.

https://i.sstatic.net/I5njY.png

To update the version of VSCode, follow the steps outlined in the image below.

https://i.sstatic.net/BfLom.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with IntelliJ: TypeScript Reference Paths Are Not Relative

I am currently using IntelliJ as my IDE, but I am facing an issue with configuring gulp-typescript to compile my typescript code. The problem arises from the fact that IntelliJ does not treat my reference paths relatively, instead it references them from m ...

Consecutive Vows in TypeScript

My TypeScript class has a save method that I want to only let the next call happen once the first one is completed. Consider this scenario: count = 0; async save() { let x = this.count++; console.log("start " + x); await axi ...

Cypress - AG-Grid table: Typing command causing focus loss in Cell

Encountering a peculiar issue: I am attempting to input a value into the cell using 'type()'. My suspicion is that each letter typed causes the focus on the cell to be lost. It seems that due to this constant loss of focus and the 'type()& ...

There is no registered handler for channel - Electron IPC handle/invoke

When using my Electron app, I keep encountering the error message "No handler registered for 'channel-name' at EventEmitter../lib/renderer/api/ipc-renderer.ts.ipcRenderer.invoke (electron/js2c/renderer_init.js:1163:19)". This issue seems to stem ...

Encountering a Typescript error when trying to pass a function as a prop that returns SX style

Imagine a scenario where a parent component needs to pass down a function to modify the styles of a reusable child component: const getStyleProps: StyleProps<Theme> = (theme: Theme) => ({ mt: 1, '.Custom-CSS-to-update': { padding ...

Errors slipping through the cracks of Express middleware

When it comes to using express and typescript, I am attempting to create a middleware for error handling similar to Sentry. Below is the code snippet: const catchError = ( error: Error, req: Request, _res: Response, next: any ) => { console. ...

Utilize a universal type for the property name in TypeScript

In my code, I am using an enum as a propName for an object-like type. export enum WeaponClass { smallLaser = "smallLaser", } export type WeaponType = { [propName in WeaponClass]: number }; const weapons: WeaponType = { [WeaponClass.smallLase ...

Error: TypeScript is unable to locate the 'moment' module

My TypeScript React application was set up using npx create-react-app --template typescript. However, when I try to start the app with npm start, I encounter an error in one of my files: TypeScript error in /<path>/App.tsx: Cannot find module ' ...

The performance of the frontend application is severely degraded due to a bottleneck in Graphql nested queries when using Django and React. Assistance in resolving this issue would be greatly

My current project involves using Python+Django and GraphQL (graphene) for the backend, MySQL as the database, and React.js for the frontend. Once a user logs in on the frontend, the following query needs to be executed: const GET_ORGANIZATION = gql` quer ...

The boolean type in TypeScript is throwing an error because it does not have any call

Currently, I am grappling with an issue in my Typescript and React Native project. The error message displayed on the console reads: "This expression is not callable. Type 'Boolean' has no call signatures." My code consists of a simple home page ...

How can I enable editing for specific cells in Angular ag-grid?

How can I make certain cells in a column editable in angular ag-grid? I have a grid with a column named "status" which is a dropdown field and should only be editable for specific initial values. The dropdown options for the Status column are A, B, C. When ...

Ways to prevent the use of the JavaScript increment (++) or decrement (--)

I have created two functions for a multi-step configuration on a webpage. protected clickNext(event:any, config:any) : any{ this.activeIndex++; } protected clickPrev(event:any, config:any) : any{ this.activeIndex--; } Here are the buttons: < ...

Nexus and GraphQL: The root typing path for the "context" type is not found

Iā€™m currently working on integrating GraphQL into Next.js API routes. For writing the GraphQL schema, Iā€™m utilizing Nexus. Here are the two essential files: context.ts and schema.ts, that help in setting up Nexus development mode. // context.ts import ...

Flipping the order of arguments in curried functions with fp-ts

I've been working with fp-ts and encountered a situation where I have a curried function consisting of two functions, like this: const newFunction = (name: string) => (greeting: string) => console.log('Hello ' + name + ' ' + ...

Class with an undefined function call

Currently, I am working with angular2 and TypeScript where I have defined a class. export class Example{ //.../ const self: all = this; functionToCall(){ //.. Do somerthing } mainFunctionCall(){ somepromise.then(x => self.fu ...

Encountering TypeScript error TS2345 while attempting to reject a Promise with an error

I recently encountered a perplexing TypeScript error message that I am struggling to comprehend. The specific error reads as follows: error TS2345: Argument of type '(error: Error) => void | Promise' is not assignable to parameter of type & ...

Utilize React Styled Components to seamlessly unify the styles of two different components

I want to have consistent styles for both a styled input element and a styled select element. Currently, I accomplish this using string interpolation: const styles = ` background-color: white; width: 100%; border: 0 solid transparent; bor ...

Ways to implement distinct values for model and input field in Angular 5

I'm currently working on an Angular 5 application and I have a requirement to format an input field with thousand separators (spaces). However, the model I am using only allows numbers without spaces. Since my application is already fully developed, ...

Enhancing TypeScript type definitions for the Response.render() method in Express

Struggling with enhancing the type safety of my Express project by extending the Response.render function. import { Response } from "express"; import { Product } from "../models/Product.interface"; export interface ProductListResponse ...

Error in custom TypeScript: Incorrect error instance detected within the component

I encountered a unique issue with my custom Error export class CustomError extends Error{ constructor(message: string) { super(message); Object.setPrototypeOf(this, CustomError.prototype); this.name = "CustomError"; } Furthermore ...