Fading Coder

One Final Commit for the Last Sprint

Understanding TypeScript Interfaces, Classes, and Abstract Classes

Understanding TypeScript Interfaces, Classes, and Abstract Classes Interface, class, and abstract class are three fundamental concepts in TypeScript that have both connections and distinctions. This article explores the relationships between these constructs based on TypeScript's official documentat...

Radash Array Utilities: Core Methods and Implementation Breakdown

iterate: Sequential Value Transformation Usage Executes a transformation function repeatedly over a specified number of steps, carrying forward an accumulator value. Example import { iterate } from 'radash' const total = iterate( 5, (accumulator, step) => accumulator + step * 2, 0 ) // Result: 30...

HarmonyOS Development Notes

Day One Initialize a new NPM project (follow the prompts): npm init Install TypeScript, TSLint, and Node.js type definitions: npm install -s typescript tslint @types/node Create a file named tsconfig.json in the root directory and add the following configuraton: { "compilerOptions": { &quo...

Configuring ESLint and Prettier for a Next.js TypeScript Project

Integrating ESLint and Prettier This guide details the setup for integrating ESLint for code quality analysis and Prettier for code formatting with in a Next.js project using TypeScript. The configuration enables automatic formatting and linting on file save in VS Code. Required VS Code Extensions E...

Extending Built-in JavaScript Types in TypeScript

When subclassing native JavaScript constructors like Error or Array in TypeScript, unexpected behavior can occur if the code is compiled to ES5. Consider the following TypeScript implementation: class CustomFailure extends Error { constructor(errorMsg: string) { super(errorMsg); // Explicitly resto...

Building a Backend System with Vue.js, TypeScript, and Vue CLI 3.0

Setting Up a Vue.js Project with TypeScriptVue.js combined with TypeScript offers a robust development experience. While Vue doesn't have the same level of TypeScript integration as frameworks like Angular, TypeScript's type checking and modern ES6 features provide significant advantages. This guide...

Dynamic SVG Loading in Vue 3 with TypeScript and Vite

Processing Country Data and Loading Dynamic SVGs In this implementation, we'll demonstrate how to process API data containing country information and dynamically load corresponding SVG flags using Vue 3, TypeScript, and Vite. Processing API Response Data First, we need to process the raw data from o...

Understanding Functions and Interfaces in JavaScript and TypeScript

Functions in JavaScript Functions serve as the fundamental building blocks in JavaScript, enabling code reuse and modularity. Unlike in languages with interfaces, functions themselves are first-class citizens—they can be assigned to variables, past as arguments, and returned from other functions. //...

Validating Data with Yup and Testing Schemas Using Jest

When building forms or handling user input, robust validation is essential. Instead of writing custom logic for every field, leveraging a schema-based validation library like Yup streamlines the process and improves maintainability. Yup allows defining schemas that describe expected data structures,...

TypeScript Utility Functions for Runtime Type Checks

Core Type Matching Function const typeString = Object.prototype.toString; export function matchesType(input: unknown, expectedType: string): boolean { return typeString.call(input) === `[object ${expectedType}]`; } Check if Defined export function isDefined<T = unknown>(value?: T): value is T...