Next JS build not displaying Typescript errors during npm build

I've been in the process of converting a Next JS project from JavaScript to TypeScript. Intentionally making mistakes to test the type checking, for example:

export class Knot {
  position: Vector2;
  locked: number;
  deletable: boolean;
  isLast: boolean;
  isActive: boolean;
  handles: { in: Vector2, out: Vector2 };

  constructor(position: Vector2, locked: boolean, isLast: boolean, isActive: boolean = false, deletable: boolean = true) {
    this.position = position
    this.locked = locked //0 = not locked, 1 = y is locked, 2 = x is locked, 3 = z is locked
    this.deletable = deletable
    this.isLast = isLast
    this.isActive = isActive
  }
}

Noticing that the locked variable is being assigned a boolean value when it is declared as a number. My editor shows an error, but surprisingly, it doesn't throw any errors when I run npm run build.

I've double-checked, and I don't have the ignoreBuildErrors: true setting configured anywhere within the project.

The project is using turborepo. I'm unsure if this setup affects the type checking behavior.

Here is a snippet from my tsconfig:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Next.js",
  "extends": "./base.json",
  "compilerOptions": {
    "target": "es5",
    "noImplicitAny": false,
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "incremental": true,
    "esModuleInterop": true,
    "module": "esnext",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "include": ["src", "next-env.d.ts"],
  "exclude": ["node_modules"]
}

Answer №1

For a quick check of your TypeScript files without generating any output files, give npx tsc --noEmit a try. This command is designed to identify any type errors in your code and provide you with valuable insights for troubleshooting.

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

What is the best way to simulate a static variable in JavaScript unit testing?

After running the karma coverage test, I achieved a coverage of 99.3%. To reach 100%, I require assistance in testing the else part of the function below: createCurrencyUnits(): void { var keys = Object.keys(ObjectsDomainConstants.CURRENCY_UNITS); for (va ...

Packaging npm modules involves including files from the root folder of a package within a monorepo

In my monorepo setup, I have a mix of private and public packages. There are some common files in the root folder that I want to include when I run npm pack. I tried creating symlinks and specifying '../../file' in the files attribute of the pack ...

Creating a blueprint for an object that inherits from another interface

I am looking to create an interface that includes unknown properties for one object, while also extending it with known properties from another interface. Here is my attempt: public async dispatchMessage(): Promise<{} extends IHasResponseFormat> I ...

Incompatible parameter type for the Angular keyvalue pipe: the argument does not match the assigned parameter type

I need to display the keys and values of a map in my HTML file by iterating over it. To achieve this, I utilized Angular's *ngfor with the keyvalue pipe. However, I encountered an error when using ngFor: The argument type Map<string, BarcodeInfo ...

What could be causing my dropdown in Next.js 13 to not update when using router.refresh(), even though it successfully updates other components?

Issue: In my Next.js 13 project, I am facing a challenge with two client components: AddFrequentIngreso and AddIngreso. The purpose of the AddFrequentIngreso component is to add frequent income sources to a database, while the AddIngreso component contain ...

What kind of impact does the question mark at the conclusion of a function title make?

I came across the following TypeScript code snippet: class Foo { start?(): void {} } What caught my attention was the ? at the end of start. It appears to be making the function optional (but how can a function be optional and when would you need tha ...

I keep encountering an error with the Next.js Image component, even though I have properly included the src prop

By passing the src prop to the UserCard component, I am encountering the following error message. Error Unhandled Runtime Error Error: Image is missing required "src" property. Make sure you pass "src" in props to the `next/image` comp ...

Dealing with Scoping Problems in a Typescript d3 Update Tutorial

I'm facing challenges trying to implement the provided bl.ocks example in Typescript (using Angular). This is my implementation in TypeScript: StackBlitz Could anyone offer insights on what might be causing the issues I'm encountering? My initi ...

Caution: The `className` property does not align with Material UI css which may cause issues upon reload

https://i.stack.imgur.com/MxAiY.png If you are facing the error/missing CSS, check out this video for a visual representation. While older versions of similar questions exist on Stack Overflow such as React + Material-UI - Warning: Prop className did not ...

Unlock hidden Google secrets within your Angular application using Google Secret Manager

Can the Google Secret Manager API be accessed with a simple API call using an API key? https://secretmanager.googleapis.com/v1/projects/*/secrets/*?key=mykey returns a 401 unauthenticated error. While the Node.js server powering the Angular app uses the c ...

Error in Next.js PDFtron Webviewer: ReferenceError - 'window' is not defined

Currently, I'm faced with a challenge in setting up a PDF viewer on my nextjs static page. Having recently ventured into Next.js, I'm seeking assistance from you guys to resolve this issue or suggest an alternative approach. While trying to imple ...

Encountering the message "bnr is not recognized as an internal command" during the development process of an Ionic2-Cordova

I am encountering an error while attempting to build Android. Is there anyone who can assist me with this issue? 'bnr' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno ...

How can I replace any non-alphanumeric characters in a string with an underscore using JavaScript or TypeScript?

There is a unique string generated from an external data source that I cannot manage. The system above me necessitates the IDs to adhere to this rule: "Field names should start with a letter and can solely consist of letters, numbers, or underscores (&apos ...

Implementing dynamic Angular form group array with conditional visibility toggling

Within my angular application, I am faced with the task of implementing a complex form. Users should be able to dynamically add, remove, and modify elements within the form. Each element consists of a group of inputs, where some are conditionally hidden o ...

Tips for displaying Next.js dynamic paths on a static S3/CloudFront website

Help Needed with Next.js Setup on S3 and CloudFront While setting up Next.js with static website hosting on S3 and CloudFront, I have encountered an issue with dynamic routes. My directory structure is as follows: pages/ index.js about.js [id].js A ...

Running pipes across different platforms in NPM scripts

Imagine we have an NPM script with a pipe, similar to the approach suggested in the Istanbul documentation: "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls" But this method doesn't cater for Windows users. Is there a ...

React Leaflet causing a frequent map refresh due to context value updates

When I use map.on('moveend') to update the list of markers displayed in another component, I encounter a refreshing issue. The context in my project contains two arrays - one filtered array and one array with the markers. When I try to update the ...

My NodeJS server is malfunctioning when trying to remove a server

After successfully running my NodeJS server on a remote server using the script "next", I received the message "Running in localhost:3000". However, when attempting to access it via IP:3000, I did not receive a response from the server. What steps should I ...

The alignment of the first and second steps in Intro.js and Intro.js-react is off

There seems to be an issue here. Upon reloading, the initial step and pop-up appear in the upper left corner instead of the center, which is not what I anticipated based on the Intro.js official documentation. https://i.stack.imgur.com/ICiGt.png Further ...

Bull-Board - interface display issue - CSS files not loading?

The Bull-Board UI appears to be functioning correctly, but the display presentation seems to be off. It looks like there may be some missing CSS causing the issue? Check out the package on GitHub for more information: https://github.com/vcapretz/bull-board ...