Troubleshooting guides by topic

Next.js, React and TypeScript

Client/server rendering, components, hooks, TypeScript and build errors.

70 English guides in this category

React: change ref.current does not update the counter on screen

Click increases ref.current, but the interface still shows the previous number.

Read the solution

React: Clicking the second button accidentally sends the form

The button opening the preview in the middle of the form calls a submit and saves incomplete data.

Read the solution

React: Encountered two children with the same key in the record list

After updating or filtering the list items are wrong and the console warns about identical keys.

Read the solution

React: Maximum Update Depth Exceeded in useEffect

Once the CPU page is opened, the component renders itself in the loop and a maximum update depth error appears.

Read the solution

React: Modal Loses Keyboard Focus

When the Tab dialog is opened, it goes to items under modal, and Escape does not close the window.

Read the solution

React: older fetch response overwrites newer search results

After quickly entering a new query, the list shows the answer for the previous text.

Read the solution

React: Rendered Fewer Hooks Than Expected

After hiding a fragment of the React form, it throws a smaller number of hooks.

Read the solution

React: setInterval Creates Duplicate Requests After Switching Tabs

Each reopening of the panel leads to another timer and an increasing number of API requests.

Read the solution

The site in React looks good, but the robot sees little content

CSR vs SSR and static rendering in React/Next.js. How to make sure the text and links are available to Google.

Read the solution

TypeScript TS1259 default import without esModuleInterop

The default import of CommonJS libraries ends with the TS1259 compatibility error.

Read the solution

TypeScript TS18003 No inputs were found in config file

The tsc command reports that it did not find any input files, although repo has .ts and .tsx files.

Read the solution

TypeScript TS18046: variable error has an unknown type in catch

Catch(error) code does not allow you to read error.message even though you see Error in the console.

Read the solution

TypeScript TS2307: Cannot Find Module Despite Installation

The editor or build reports the TS2307 for a library that appears in node modules.

Read the solution

TypeScript TS2322: String Is Not Assignable to Number

After reading the numeric field from HTML TypeScript does not allow to assign its value to the number.

Read the solution

TypeScript TS2532: Object Is Possibly Undefined

Typecheck reports the possibility undefined when reading the property of an asynchronous object.

Read the solution

TypeScript TS2688 Cannot find type definition file for Node

The compiler reports no Node declaration, although the JavaScript code is built through a Bundler.

Read the solution

TypeScript TS2741: Property is missing in type when creating an object

After adding the required field to the User compiler type, the form object is rejected without this property.

Read the solution

TypeScript TS7053: string cannot index a defined object

Reading translations[key] does not go compilation when key has a string type and object only finished keys.

Read the solution

TypeScript: alias paths works in the editor, but Node does not find the module

TS and IDE solve @/lib/config, but the running Node script reports MODULE NOT FOUND.

Read the solution

TypeScript: import must be type-only at verbatimModuleSyntax

The compiler rejects an interface import that was to be used only as a type.

Read the solution

TypeScript: new value enum skips incomplete switch

After adding a new order status, one branch of UI displays an empty text, although build passes.

Read the solution

TypeScript: No overload matches this call in event handler

The TS2769 message appears when calling a function with several signatures, despite seemingly compatible arguments.

Read the solution
All English guides
Next.js, React and TypeScript — troubleshooting and solutions