ECMAScript Modules (ESM) enable the importing and exporting of code and are supported in modern web browsers, Deno, Bun, and Node.js. It's recommended to use ESM as major frameworks are already embracing it. Let this tutorial guide you through the process.
Type coercion is when one type of data is automatically changed into another type. For example, TypeScript can change a number into a string. This happens automatically to prevent errors when different types interact.
TypeScript has a structural type system, which means that types are compatible based on their shape or structure rather than their names. This allows you to interchangeably use types with different names but identical properties. You can assign one type to another if they share the same properties, including optional properties.
TypeScript 4.9 introduces the "satisfies" operator, which allows us to verify that the type of an expression matches a specific type. This operator can be used to narrow down a union type and provide more precise type checking. In the example given, the "satisfies" operator is used to restrict the keys and values of a record type.