TypeScript learning notes - Omit

After version 3.5, TypeScript added an omit < T, k > type. Omit < T, k > types can exclude some attributes from inherited object attributes. type User = { id: string; name: string; email: string; }; type UserWithoutEmail = Omit<User, "email">; // Equivalent to type UserWithoutEmail = { id: string; name: string; }; ...

Posted by echo10 on Mon, 07 Mar 2022 09:36:02 +0100

Typescript - Advanced

object-oriented That is, the operations in the program need to be completed through objects, for example: To operate the browser, use the window objectThe document object is used to manipulate the web pageTo operate the console, use the console object In the program, all objects are divided into two parts: data and function. There is no more ...

Posted by dieselmachine on Mon, 21 Feb 2022 13:39:01 +0100

Vue3+Ts Episode 1

The first installment introduces the configuration of development tools introduce TypeScript introduction 1 TypeScript is an open source programming language developed by Microsoft. 2. TypeScript is a superset of JavaScript and follows the latest ES6 and Es5 specifications. TypeScript extends the syntax of JavaScript. 3. TypeScript is mor ...

Posted by dnice on Thu, 17 Feb 2022 16:51:07 +0100

Basic types of data in ts

ts data type ts data basic data type After declaring the type, the type of the variable cannot be changed A vertical bar |: indicates or is used to connect multiple types (Union types) question mark? Representative optional &Represent and boolean type let bool:boolean=true Number type number let num:number=10 String type string ...

Posted by Valdoua on Sat, 12 Feb 2022 15:20:28 +0100

TypeScript advanced type 2 you need to know (summary)

Type inference: If no type is explicitly specified, TS will infer a type according to the rule of Type Inference: let myFavoriteNumber = 'seven'; //No mistake myFavoriteNumber = 7; //Type 'number' is not assignable to type 'string'. Note: different from declaring no assignment, declaring no assignment will be set to any ...

Posted by rndilger on Thu, 20 Jan 2022 06:06:48 +0100

Advanced TypeScript types you need to know (summary)

preface For students with JavaScript foundation, it is actually easy to get started with TypeScript. You can gradually transition from JS application to TS application by simply mastering its basic type system. // js const double = (num) => 2 * num // ts const double = (num: number): number => 2 * num However, when the application b ...

Posted by sylesia on Tue, 18 Jan 2022 06:33:29 +0100

Component library actual combat | using vue3+ts to realize global Header and list data rendering ColumnList

🖼️ preface Recently, I used vue3 and ts to play with some gadgets. I found that a common requirement in normal development is the rendering of data list. Now I study again and find that many design specifications and logic I considered when learning vue2 are not particularly appropriate. Therefore, write this article to record the desig ...

Posted by DanArosa on Mon, 17 Jan 2022 22:47:47 +0100

TypeScript decorators

  Decorator is a special type of declaration that can be attached to class declarations, methods, accessors, properties or parameters to modify the behavior of a class. The decorator uses @ expression. Expression must be a function after evaluation. It will be called at run time, and the decorated declaration information will be passed in as ...

Posted by alcapone on Tue, 04 Jan 2022 08:10:24 +0100

Beginner TS - basic type of TS

Basic type of TS Boolean type let isDo:boolean = true; === var isDo = true Number type let num:number = 5; === var num = 5 String type let name:string = 'mery'; === var name = 'mery' Array type let arr:number[] = [1,2,3]; === var arr =[1,2,3] let arr:Array<number> = [4,5,6]; //Array < number > is a gen ...

Posted by puja on Thu, 30 Dec 2021 14:56:47 +0100

[JS/TS] how to write regular expressions? input form validation

1, Regular expression overview Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. 2, How to create regular expressions Call the constructor of the RegExp object to create it const regexp=new RegExp(/123/); //123 is the regular expression content Creat ...

Posted by Ironmann00 on Sun, 31 Oct 2021 18:19:23 +0100