Library Search
结果页

TypeScript 入门到进阶

在 知识库 中找到 8 个匹配结果。

返回文档库
知识库

知识库

8 个
TypeScript 入门到进阶 # TypeScript 入门到进阶教程 ## 第一章:为什么要学 TypeScript JavaScript 是动态类型语言——变量类型在运行时确定。这带来灵活性,但在大型项目中是灾难: - 重构一个函数签名,不知道哪些调用会炸 - 后端返回的数据结构,只能靠注释来约定 - `undefined is not a function` 是最常见的运行时错误 TypeScript 在 JS 之… 3% 类型系统初探——从 JS 到 TS 的迁移 # TypeScript 例程:从 JavaScript 到 TypeScript 的类型迁移 ## 目标 展示 TypeScript 核心类型系统:基础类型、Interface、泛型、类型守卫,并对比 JS 常见坑点。 ## 完整代码 ```typescript // ── 1. 基础类型注解 ── let username: string = "Alice"; let age: numb… 3% 入门篇 - Vue 3 毕设实战 () </script> ``` ### 4. 状态管理:Pinia ```typescript // stores/user.ts import { defineStore } from 'pinia' export const useUserStore = defineStore('user', () => { const token = ref('') const userIn… 3% 入门篇 - React 18 毕设基础 分步操作:搭建毕设项目 ### Step 1: Vite + React + TypeScript ```bash npm create vite@latest grad-project -- --template react-ts cd grad-project npm install npm run dev ``` ### Step 2: 安装必备库 ```bash npm insta… 3% NestJS 毕设实战 — 企业级架构入门 器**(控制反转)。你不需要手动 `new` 对象,容器自动帮你组装: ```typescript // ❌ 传统方式 — 紧耦合 class UserController { constructor() { this.userService = new UserService(); // 写死了! } } // ✅ NestJS 方式 — DI 注入 @Injectable(… 3% 入门篇 - Angular毕设项目架构 | ### 2. 装饰器(Decorator) Angular 大量使用 TypeScript 装饰器标记类: ```typescript @Component({ selector: 'app-student', templateUrl: './student.component.html' }) export class StudentComponent { } @Injectabl… 3% NestJS 入门 — 学生管理系统模块 /students/dto/create-student.dto.ts` ```typescript import { IsString, IsInt, Min, Max, IsEmail, IsOptional } from 'class-validator'; export class CreateStudentDto { @IsString() name: string; @… 3% 入门教程 - 企业级框架核心概念 —包含路由、表单、HTTP 客户端、状态管理、测试工具、SSR,开箱即用。使用 TypeScript 开发,强制采用 RxJS 进行异步编程。 ### 核心哲学 > "电池全包含"——不让你纠结选什么路由库、状态管理,Angular 都提供了官方方案。 ## 二、核心概念地图 ``` NgModule(模块) ├── Component(组件)—— 视图 + 逻辑 │ ├─… 3%