If your application is in the proof of concept phase, it works and you just want to build it, you can disable the linting process to have a successful build regardless of linting errors.
Category Archives: Not for home page
Object is possibly ‘undefined’
The ESLint static code analysis tool flags code where we operate on objects which can be undefined. Object is possibly ‘undefined’ The end of the red line shows the extent of the object which can be undefined, as the “children” element is defined as optional in the type definition: To satisfy the linter, we need to …
Type error: Type ‘string’ is not assignable to type ‘number’
When you create an array in TypeScript the type of the first element defines the type of all elements of the array. When we reuse an array with new data, the array type has already been defined, so when we assign new values to the same array we get the error message: Type error: Type …
Continue reading “Type error: Type ‘string’ is not assignable to type ‘number’”
Type ‘null’ is not assignable to type ‘string’
In a TypeScript application ESLint flags code when we try to assign “null” value to string type variables and attributes. This can be necessary when we want to set the value of a database column to “null”. To make a string type attribute nullable, add ” | null ” to the type definition:
Error: Component definition is missing display name react/display-name
If you use the VirtualTable in a React TypeScript web application ESLint will throw an error when it checks the VirtuosoTableComponents. Error: Component definition is missing display name react/display-name The Virtuoso component uses arrow functions to declare the Scroller and TableBody. Arrow functions do not provide the displayName property used by developer tools. We can modify the component to …
Continue reading “Error: Component definition is missing display name react/display-name”
Horizontal scrolling cards
We can use simple CSS settings to scroll cards horizontally in a container. Apply these settings to the container <div>: Configure the card <div>s with this:
Creating tables with PostgreSQL
Identity columns There are three auto incremented identity columns types in PostgreSQL Name Storage Range SMALLSERIAL 2 bytes 1 to 32,767 SERIAL 4 bytes 1 to 2,147,483,647 BIGSERIAL 8 bytes 1 to 9,223,372,036,854,775,807 To create a new identity column use the following syntax
… you might have mixed up default and named imports
In a Next.js React web application we can export functionality two ways: The two definitions have to be imported with two different syntaxes If we try to use the wrong import statement, we get the following error message: Make sure your import statement matches the definition format.
The top-level-await experiment is not enabled
When we try to call an async function with await from a .tsx file in a Next.js React TypeScript web application we get the error message: Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) The …
Continue reading “The top-level-await experiment is not enabled”
Module not found: Can’t resolve ‘fs’
If you use Webpack version 5 or later you may encounter the error message Module not found: Can’t resolve ‘fs’ The cause is, that Webpack 5 has a breaking change, and the “fs” module is most likely not included anymore in the client-side code. To eliminate the issue, add the “browser” element to the package.js …