JSDoc, an alternative to TypeScript?

Many developers prefer using TypeScript because of its type checking capabilities. However, this requires an additional translation step, which can cause trouble and waste time. This article will show you how to use JSDoc to get the same type of control, while using pure JavaScript for the fastest development times and better documentation! JavaScript has […]

nodemon typescript?

Table of Contents 1. Install typescript in vscode 2.Typescript is compiled into JavaScript 3.tsconfig.json configuration 4.vscode’s detection function for typescript When I was writing the API interface, I felt very unhappy that there was no prompt, so I wanted to use typescript to rewrite all the js’ files I assume that you use vscode to […]

TypeScript enums (hyper-verbose)

The Enum type is used in scenarios where the values are limited to a certain range, for example, there can only be seven days in a week, and the colors are limited to red, green, and blue, etc. TS enumeration is inspired by C# Simple example Enumerations are defined using the enum keyword: enum Days […]

Build a front-end development project from scratch based on Vite4, Typescript, React18, react-router-dom6.4, Redux4, Reduxjs/toolkit, and Ant Design5.9

Build a front-end development project from scratch based on Vite, Typescript, React, react-router-dom, Redux, Reduxjs/toolkit, and Ant Design vite project initialization Native environment node v16.14.2 npm 8.5.0 yarn 1.22.18 vite project initialization yarn create vite Follow the steps to enter the project name, select React for the framework, and use TypeScript for js to create […]

TypeScriptGet to know TypeScript

Author: Laojiu Personal blog: Laojiu’s CSDN blog Personal quote: Facing uncontrollable things with optimism Series of columns: Article directory TypeScript Disadvantages of Javascript Refactoring using TypeScript TypeScript compilation environment Globally install the TS compilation environment TS compilation simplified TS variable declaration TS variable type deduction type of data Javascript data types TypeScript data types Do […]

Typescript generics, keyof, typeof, index type, mapping

Typescript generics A major part of software engineering is building components that not only have well-defined and consistent APIs, but are also reusable. Components that can handle today’s and tomorrow’s data will give you the most flexible ability to build large software systems. Use generic type variables function identity<Type>(arg: Type): Type { return arg; } […]

Typescript types and the difference between types and interfaces

[Official Document](TypeScript: JavaScript With Syntax For Types.) > The following is a condensed version. If you don’t want to read the full article, just read the following content. ts has 8 built-in types Number String BigInt Boolean Symbol Null Undefined Object For more details, please refer to [MDN](JavaScript data types and data structures – JavaScript […]

Typescript enums and scope reduction

About enumeration Reverse mapping principle In the past, I only knew how to build and use enumerations, but I didn’t know how to get the enumeration content through Typescript. Through keyof typeof Reverse mapping to obtain enumeration key enum Enum { A, } let a = Enum.A; let nameOfA = Enum[a]; // “A” About constant […]