ICode9

精准搜索请尝试: 精确搜索
  • TypeScript 笔记2022-08-07 20:33:58

    1. TypeScript 的介绍 TypeScript 是 JavaScript 的一个超集,支持 ECMAScript 6 标准,由微软开发的自由和开源的编程语言 通俗的说,TypeScript 在 JavaScript 的基础上添加了类型支持,可以在代码编写阶段就发现代码的错误 浏览器本身不支持直接运行 TypeScript 代码,需要将其编译成 Ja

  • [Typescript] Dictionary map, filter and reduce2022-08-07 02:01:18

    const fruits = { apple: { color: "red", mass: 100 }, grape: { color: "red", mass: 5 }, banana: { color: "yellow", mass: 183 }, lemon: { color: "yellow", mass: 80 }, pear: { color: "green", mass:

  • [Typescript] Definite assignment operator2022-08-03 20:36:28

    The definite assignment !: operator is used to suppress TypeScript’s objections about a class field being used, when it can’t be proven1 that it was initialized. Definite assignment operator can help with this case, if you are sure that the code will h

  • TypeScript的那些事2022-08-03 14:34:25

    TypeScript 1.数据类型 1 1. number string boolean array 元组 枚举 null undefined void never 2 TS规定一旦变量在初始时定义了变量类型,那么就不能修改。 3 初始化str变量为string类型,就不能更改为number类型 4 let str : string = "123456" 5 6 数组类型: 7 let arr

  • [Typescript] Type Guard: is & assert2022-08-03 13:31:59

    value is Foo The first kind of user-defined type guard we will review is an is type guard. It is perfectly suited for our example above because it’s meant to work in cooperation with a control flow statement of some sort, to indicate that different branch

  • [Typescript] Exhaustive conditionals - UnreachableError helper class2022-08-03 02:32:48

    class UnreachableError extends Error { constructor(_nvr: never, message: string) { super(message) } } class Car { drive() { console.log("vroom") } } class Truck { tow() { console.log("dragging something") } } c

  • 关于自己2022-07-31 23:35:11

    信息安全人员, 技术栈: JAVA python VUE2 VUE3 ES6 typescript Docker 联系方式:rootphantomy#hotmail.com

  • 为什么TypeScript不直接让浏览器支持,而是要编译成JavaScript呢?2022-07-31 23:02:54

    众所周知,JavaScript几乎成了浏览器唯一的编程语言,在IE的年代,IE还支持VBScript,可惜我没有学,现在几乎没人提起了,清一色的JavaScript。 JavaScript的一些缺点或者缓慢的发展进度,导致了TypeScript的产生,把TyepScript编译成JavaScript代码,在浏览器里执行。 那么,为什么非要编译成JavaScr

  • typescript的?? 和?: 和?.是什么意思?2022-07-28 18:05:21

    ?:是指可选参数,可以理解为参数自动加上undefined function echo(x: number, y?: number) { return x + (y || 0); } getval(1); // 1 getval(1, null); // error, 'null' is not assignable to 'number | undefined' interface IProListForm { enterpriseId: stri

  • [TypeScript] Interface2022-07-27 19:35:04

    An interface is a way of defining an object type. An “object type” can be thought of as, “an instance of a class could conceivably look like this”. For example, string | number is not an object type, because it makes use of the union type operator.

  • [Typescript] Recursion Type2022-07-27 19:34:36

    Recursive types, are self-referential, and are often used to describe infinitely nestable types. For example, consider infinitely nestable arrays of numbers [3, 4, [5, 6, [7], 59], 221] You may read or see things that indicate you must use a combination o

  • TypeScript阶段学习2022-07-26 18:03:23

    TypeScript 首先来了解一下TypeScript TypeScript是JavaScript的,带有类型的超集,它可以编译成纯JavaScript。 TypeScript可以在任何浏览器、任何计算机和任何操作系统上运行,并且是开源的。 超集:支持所有的js,并在此基础上添加了额外的功能 有类型的:js类型是动态的,只有在运行时可

  • TypeScript学习笔记2022-07-26 15:05:36

    参考文章: https://juejin.cn/post/7003171767560716302 https://juejin.cn/post/7018805943710253086 TypeScript是JavaScript的超集,因为它扩展了JavaScript的语法。TypeScript就是为了做语法检查,提早发现错误,所以「类型」是其最核心的特性。 一、安装 执行全局安装: npm insta

  • [Typescript] Tuple type usage example2022-07-26 15:03:06

    function flipCoin(): "heads" | "tails" { if (Math.random() > 0.5) return "heads" return "tails" } function maybeGetUserInfo(): | ["error", Error] | ["success", { name: string; email:

  • [Typescript] Making TypeScript Stick - 32022-07-26 14:32:26

    1. const values = [3, "14", [21]] for (let a in values) { // ^? } for (let b of values) { // ^? } . . . . Answer: for...in loop: The for...in statement iterates over all enumerable properties of an object that are keyed by strings (i

  • 利用用户脚本优化 Yandere/Konachan 站点浏览体验2022-07-25 23:35:38

    中文标签、缩略图放大、双击翻页与瀑布流浏览模式,更舒服的 Booru 站点浏览体验 前言 Y 站与 K 站都是寻找壁纸的好网站,日常必备,只可惜浏览体验不是很好,网站界面与标签都是英文,图片列表页面缩略图也比较小。这个时候自然要无敌的油猴脚本出马了,我便立马打开了 Greasy Fork 进行搜

  • jsx/tsx使用cssModule和typescript-plugin-css-modules2022-07-25 14:02:20

    目录1,前言2,效果图3,如何使用3.1,安装3.2,配置4,示例5,插件错误处理5.1,错误触发原因5.2,解决办法 1,前言 在vite/webpack搭建的项目中,不管是vue还是react,都可以写jsx/tsx,为了避免样式污染,常用的方式有两种。一种是每个组件都用一个唯一类名class包裹,使用less/scss嵌套样式。另一种是使用cs

  • 001简介2022-07-21 10:34:36

      TypeScript和JavaScript比较   [A] JavaScript         JavaScript(缩写:JS)是一种运行在客户端(比如浏览器)中的编程语言         当应用于浏览器时,为网站提供动态交互特性,让网页"动"起来         运行环境:             浏览器和NodeJS         NodeJS

  • 项目一(Vue3 - TypeScript - element-plus)2022-07-21 02:31:52

    项目一:Vue3-TypeScript 电商后台管理 一、技术栈涉及 Vue3 TypeScript axios vue-router element-plus node.js 二、项目概述 界面展示 登陆页面 商品管理 用户列表 员工信息编辑 职位编辑 修改权限界面(隐藏路由) 本地接口数据 功能 * 实现登陆路由拦截,获取token后才能实

  • [TypeScript] infer2022-07-19 16:32:30

    Res1: https://www.typescript-training.com/course/making-typescript-stick/08-type-challenges/#returnoff Res2: https://learntypescript.dev/09/l2-conditional-infer   There is an infer keyword that can be used within a condition in a conditional type to put t

  • javascript和typescript的区别是什么2022-07-19 15:33:56

    区别:1、TypeScript中的数据要求带有明确的类型,JavaScript不要求。2、TypeScript引入了JavaScript中没有的“类”概念。3、TypeScript通过类型注解提供编译时的静态类型检查。 本教程操作环境:windows7系统、ECMAScript 5&&typescript3版、Dell G3电脑。 TypeScript 和 JavaScript

  • [Typescript] Unknow and any Types2022-07-19 03:00:20

    `any` type, you can assign any value for any type.   For `unkown`, you can also assign any value to unkwon:   But you cannot assign unkwon variable to another variable without checking the type, unknow force you to do the type checking before assign. i

  • tsconfig常用配置全解2022-07-19 01:31:37

    include, exclude, files配置项 extends配置 compilerOptions下的配置 compilerOptions.allowUnreachableCode compilerOptions.allowUnusedLabels compilerOptions.alwaysStrict compilerOptions.exactOptionalProperties compilerOptions.downlevelIteration compilerOptions.

  • 在NodeJS中直接运行typescript程序2022-07-14 23:04:47

    最近试着将之前的一些nodejs程序改成typescript封装,最初是通过将ts在运行时编译成js时实现的,今天试了下直接运行ts脚本试了下,发现再Webstrom中是可以直接运行的。 但是,当使用es import的时候会报错, import {foo} from "./foo";foo();console.log('hello world') 错误信息如下:(no

  • WebStorm for Mac(JavaScript开发工具)2022-07-14 10:03:48

    WebStorm  for Mac的最新中文版被称为最好用的Web前端开发神器。WebStorm 新版对JavaScript,TypeScript和CSS支持更好,改进了Vue.js的体验,并为Jest集成增加了新功能。 详情:WebStorm for Mac(JavaScript开发工具)     功能介绍 使用JavaScript解构 通过解构,您可以使用非常简洁的

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有