TypeScript 手册
关于本手册
在被引入编程社区 20 多年后,JavaScript 现在是有史以来最广泛使用的跨平台语言之一。JavaScript 最初是一种用于向网页添加微不足道的交互性的小型脚本语言,现已发展成为各种规模的前端和后端应用程序的首选语言。虽然用 JavaScript 编写的程序的大小、作用域和复杂性呈指数级增长,但 JavaScript 语言表达不同代码单元之间关系的能力却没有。结合 JavaScript 相当特殊的运行时语义,语言和程序复杂性之间的这种不匹配使得 JavaScript 开发成为一项难以大规模管理的任务。
程序员编写的最常见的错误类型可以描述为类型错误:在预期不同类型的值的地方使用了某种类型的值。这可能是由于简单的拼写错误、未能理解库的 API 表面、对运行时行为的错误假设或其他错误。TypeScript 的目标是成为 JavaScript 程序的静态类型检查器 - 换句话说,一个在代码运行之前运行的工具(静态)并确保程序的类型正确(类型检查)。
如果您在没有 JavaScript 背景的情况下使用 TypeScript,并且打算将 TypeScript 作为您的第一语言,我们建议您首先开始阅读有关 Microsoft Learn JavaScript 教程 或阅读 Mozilla 网络文档中的 JavaScript 的文档。如果您有其他语言的经验,您应该能够通过阅读手册很快掌握 JavaScript 语法。
本手册的结构
手册分为两部分:
BkU/umgVomU+reQkcB6TJGzB/ccEwAbnL1jo+b6WKEg=
R6GJzkpyAMxh5UsGdMyCt9YUk71c1Nms6DVzOIycx6LK2dOaU6TFdEgv44JcEbs4HBMtIfvuHGWHCln3pq7lNhhxPTJUbO7Em+vm5flfEDnk5RIJY5wrZNivoNnpHNi5adhkALbW/H/CuC9PhCThZQwzbe7yIOdaGasGmR1OtARbRfuVohOMljGPpEERbC7x
E4BLptJe1C9/g4CjtTUDcX+XcTjG1lHZ2mOPMEt4aga8EkO2DjErTVQexaD6JyhGUotZsV8hB0Z+bGX7/ieBELVp7yUZa2HaISIIqUVEumzuWwI6jGq0E20eO3y2erYqsaHexKEUuQChxYbPNCKE3bHd2Ez7HavxoWX+AxsuSh1RsXoimRX9BIWx782MIz49cSmJukCYFLQzGPtGtRv5ZB9ibEuQxvKp3dYcCxsc5fsOLD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