TypeScript

マイクロソフトによって開発され、メンテナンスされているフリーでオープンソースのプログラミング言語

TypeScript TypeScriptJavaScriptC#DelphiTurbo PascalTypeScript[3][4][5][6]TypeScript (Node.js) JavaScript
TypeScript
パラダイム マルチパラダイム : スクリプトオブジェクト指向構造化命令型関数型ジェネリック
登場時期 2012年10月1日 (2012-10-01)[1]
設計者 マイクロソフト
開発者 マイクロソフト
最新リリース 5.4.2[2] ウィキデータを編集/ 2024年3月6日 (3か月前)
影響を受けた言語 JavaScript, Java, C#
影響を与えた言語 AtScript
ライセンス Apache License 2.0
ウェブサイト www.typescriptlang.org ウィキデータを編集
拡張子 .ts
テンプレートを表示

TypeScript

TypeScriptJavaScriptJavaScriptTypeScript

TypeScriptJavaScriptC/C++TypeScriptjQueryMongoDBD3.jsNode.jsNode.jsTypeScript[7]

TypeScriptTypeScriptJavaScriptApache 2 License

TypeScriptMicrosoft Visual Studio 2013 Update 2first-classC# [8] Microsoft Visual Studio 2012  TypeScript [9]

歴史

編集

TypeScript2201210 (version 0.8)[10][11]Microsoft Visual Studio (IDE) LinuxOS X[12][13]2013IDEEclipsePalantir Technologies[14][15]EmacsVimSublime TypeScript[16]Atom[17]

2013TypeScript 0.9[18]TypeScript 1.0 Build 2014[19]Visual Studio 2013 Update 2TypeScript[20]

20147TypeScript5CodePlexGitHub[21]

2016922TypeScript 2.0null[22]

20172TypeScript 2.221[23]

2018730TypeScript 3.0[24]

2020820TypeScript4.04.0JSXVariadic Tuple[25]

20221115TypeScript4.9satisfiesECMAScriptauto-accessors[26]

2023316TypeScript 5.0decorators[27]

背景

編集

TypeScriptJavaScript[28]JavaScriptJavaScript[29]

TypeScriptECMAScriptTypeScriptJavaScript JavaScriptTypeScriptECMAScript 2015ECMAScriptTypeScript(使)(IDE)

言語の特徴

編集

TypeScriptJavaScript (ECMAScript5) 

ECMAScript 6







let, const

 : 

[30]

for/of



Symbol

ECMAScript 7



async/await





 - if instanceof 





Mixin







, 



ECMA-262  JScript.NET  TypeScript 

JavaScriptとの互換性

編集

TypeScript ECMAScript 2015ECMAScript 2015ECMAScript 5(JavaScript)[31]JavaScriptTypeScriptTypeScriptJavaScript

ECMAScript 3ECMAScript 3ECMAScript

TypeScriptJavaScript使JavaScriptJavaScriptTypeScript[32]DefinitelyTypednpm[33]

型アノテーション

編集

TypeScriptはコンパイル時における型検査を可能にするために、型アノテーションによる静的型付けの仕組みを提供している。この仕組みの利用は任意なので、この仕組みを無視して普通のJavaScriptの動的型付けを使うこともできる。

function add(left: number, right: number): number {
	return left + right;
}

numberbooleanstringany

JavaScript使TypeScriptNode.jsjQueryJavaScript

TypeScript使add numberleftright numbernumbernumber

any使anyJavaScriptany[34]

型宣言ファイル

編集

TypeScript.d.tsJavaScriptJavaScriptTypeScriptTypeScript使

CC++
declare module arithmetics {
    add(left: number, right: number): number;
    subtract(left: number, right: number): number;
    multiply(left: number, right: number): number;
    divide(left: number, right: number): number;
}

JavaScriptjQueryNode.js

jQueryMongoDBD3.jsNode.jsJavaScriptGitHubDefinitelyTyped[35] Typings Registrytypings

モジュール

編集

TypeScriptはコンパイルターゲットとして様々な環境をサポートしている。そのためそれらに対応した多様なモジュール/ローダーシステムに対応している。tsconfigの module 属性を用いることで ES6, ES2020, node ESM, CommonJS, AMD, UMD に適合したトランスパイルをおこなうことができる[36]

開発ツール

編集

コンパイラ

編集

TypeScripttscTypeScriptJavaScript JavaScript Apache License 2.0Node.js

JavaScriptTypeScript[37]

TypeScript
tsc --strict -t es5 *.ts

開発環境

編集

以下の統合開発環境 (IDE) やテキストエディタがTypeScriptに対応している。

関連項目

編集

注釈

編集


(一)^ TypeScript - Download: TypeScript 0.8.0

(二)^ Release TypeScript 5.4 microsoft/TypeScript (6 3 2024). 19 3 2024

(三)^ Microsoft takes the wraps off TypeScript, a superset of JavaScript | ZDNet

(四)^ TypeScript: JavaScript Development at Application Scale - Somasegar's blog - Site Home - MSDN Blogs

(五)^ Microsoft TypeScript: Can the father of C# save us from the tyranny of JavaScript? | ZDNet

(六)^ Microsoft Augments Javascript for Large-scale Development CIO.com

(七)^ borisyankov/DefinitelyTyped. GitHub. 2015426

(八)^ TypeScript Homepage, "Visual Studio includes TypeScript in the box, starting with Visual Studio 2013 Update 2"

(九)^ TypeScript 1.0 Tools for Visual Studio 2012

(十)^ Microsoft augments JavaScript for large-scale development. InfoWorld. IDG (2012101). 2015426

(11)^ Turner, Jonathan (201442). Announcing TypeScript 1.0. TypeScript Language team blog. . 2015426

(12)^  (2012101). TypeScript: First Impressions. 20121012 But TypeScript only delivers half of the value in using a strongly typed language to Unix developers: strong typing. Intellisense, code completion and refactoring are tools that are only available to Visual Studio Professional users on Windows. There is no Eclipse, MonoDevelop or Emacs support for any of the language features

(13)^ Microsoft TypeScript: Can the father of C# save us from the tyranny of JavaScript?. ZDNet (2012101). 20121012 And I think this is a pretty big misstep. If you're building web apps that run on anything other than Windows, you're likely using a Mac and most likely not using Visual Studio. You need the Visual Studio plug-in to get the IntelliSense. All you get without Visual Studio is the strong-typing. You don't get the productivity benefits you get from IntelliSense..

(14)^ TypeScript-Unterstützung für Eclipse. heise Developer (201386). 2015426

(15)^ TypeScript. Eclipse Marketplace. Eclipse Foundation. 2015426

(16)^ Hillar, Gastón (2013514). Working with TypeScript in Visual Studio 2012. Dr. Dobb's Journal. 2015426

(17)^ TypeStrong: The only TypeScript package you will ever need. 2016721

(18)^ TypeScript 0.9 arrives with new compiler, support for generics. The Register (2013618). 2015426

(19)^ Hejlsberg, Anders (201442). TypeScript. Channel 9. . 2015426

(20)^ Jackson, Joab (2014225). Microsoft TypeScript graduates to Visual Studio. PC World. IDG. 2015426

(21)^ Turner, Jonathan (2014721). New Compiler and Moving to GitHub. TypeScript Language team blog. . 2015426

(22)^ Bright, Peter (2016922). TypeScript, Microsofts JavaScript for big applications, reaches version 2.0. Ars Technica. Condé Nast. 2016922

(23)^ Daniel Rosenwasser (2017327). TypeScripts New Release Cadence. 20171129

(24)^ Documentation - TypeScript 3.0 (). www.typescriptlang.org. 2023127

(25)^ Rosenwasser, Daniel (2020820). Announcing TypeScript 4.0 (). TypeScript. 2023127

(26)^ Rosenwasser, Daniel (20221115). Announcing TypeScript 4.9 (). TypeScript. 2023127

(27)^ Documentation - TypeScript 5.0 (). www.typescriptlang.org. 2023518

(28)^ Anders Hejlsberg (2012105). What is TypeScript and why with Anders Hejlsberg. www.hanselminutes.com. 2014115

(29)^ S. Somasegar (2012101). TypeScript: JavaScript Development at Application Scale. msdn.com. 20131127

(30)^ http://techcrunch.com/2012/10/01/microsoft-previews-new-javascript-like-programming-language-typescript/

(31)^ Angular 2. angular.io. 201654

(32)^ Welcome to TypeScript. typescriptlang.org. . 2015426

(33)^ Consumption · TypeScript. 20171129

(34)^ TypeScript Language Specification p.24

(35)^ borisyankov/DefinitelyTyped. GitHub. 2015426

(36)^ "Module -module Sets the module system for the program." TypeScript. Intro to the TSConfig Reference. 2023-02-20.

(37)^ niutech/typescript-compile. GitHub. 2015426

(38)^ The Most Intelligent Extension for Visual Studio :: ReSharper - C#, VB.NET, LINQ, ASP.NET, ASP.NET MVC, XAML, XML, JavaScript, HTML, build scripts. Best-of-breed tools for code refactoring, code quality analysis, code cleanup, navigation, code generation, unit testing, and code templates.

外部リンク

編集