In JavaScript, everything is NOT an object. ECMAScript language types are:
- Undefined
- Boolean
- String
TypeScript generics come in handy when you have similar lists that you need to convert to dictionaries. Consider the following lists:
const idList = [
{ id: "0001", firstName: "Levi", lastName: "Ackerman" },
{ id: "0002", firstName: "Mikasa", lastName: "Ackerman" },
{ id: "0003", firstName: "Eren", lastName: "Yeager" },
{ id: "0004", firstName: "Armin", lastName: "Arlert" },
Material available on GitHub.
You can create a simple assertion library by creating a function that returns an object that holds a method. This lets us use the expect(result).toBe(expectedResult)
structure. However, this solution will only run the first item, and it also hides the exact location of any errors that pop up.
Handling multiple Webpack configurations for development, production, and maybe for reviews can be a chore, especially if the configuration files are made up of mostly shared content, and changes in one place have to be copied into the other configuration files.
One way to make life simpler is to compose the configuration file to be used from a base configuration file and a specialized configuration file, and then merge them together using webpack-merge
.
The idea behind this is explored in much more detail in Sean Larkin's Webpack 4 Fundamentals course at FrontendMasters.com.
So, why are there a bunch of commands available to use without paths within package.json? Well, because npm creates inside node_modules a folder called .bin that stores a whole bunch of binary executables. These are then available within the scope of package.json.
You can easily pipe commands in package.json:
"webpack": "webpack"
"dev": "npm run webpack -- --mode development"