User Tools

Site Tools


typescript_3.8

TypeScript 3.8

Return to TypeScript Version History, TypeScript, JavaScript


TypeScript 3.8, released in February 2020, introduced several key features and improvements that further enhanced its capabilities, particularly around type checking, syntax, and developer tooling. This version aimed at increasing productivity, improving project management, and offering more flexibility in coding patterns. Below is a detailed summary of the main features introduced in TypeScript 3.8, including comparisons with similar features in other languages and relevant links to TypeScript resources.

- Language Documentation: [TypeScript Documentation](https://www.typescriptlang.org/docs/) - GitHub Repository: [TypeScript GitHub](https://github.com/microsoft/TypeScript) - Official Website: [TypeScript](https://www.typescriptlang.org/) - Wikipedia: [TypeScript Wikipedia](https://en.wikipedia.org/wiki/TypeScript)

  1. Type-Only Imports and Exports

TypeScript 3.8 introduced type-only imports and exports, allowing developers to specify that certain imports are only used for type annotations, which can help optimize bundle sizes by ensuring they are not included in the JavaScript output.

```typescript import type { SomeType } from “./module”; ```

This feature is specific to TypeScript's static type system and has no direct equivalent in JavaScript, C#, Java, or Python, as those languages either don't have a separate type system (JavaScript) or don't distinguish between type and value spaces in imports (C#, Java, Python).

  1. ECMAScript Private Fields

TypeScript 3.8 added support for ECMAScript private fields, which are a part of the class fields proposal for JavaScript. Private fields are declared with a `#` prefix and provide true encapsulation from outside access.

```typescript class MyClass {

 #privateField: string;
} ```

JavaScript introduced private class fields in ES2020. C# has had private fields as part of its class definition syntax for a long time. Java also allows private fields in classes. Python uses name mangling to denote private variables (prefixing with `__`), but it's a convention rather than true encapsulation.

  1. `export * as ns` Syntax

TypeScript 3.8 supported the `export * as namespace` syntax from ECMAScript 2020, making re-exporting modules more concise.

```typescript export * as Utilities from “./utilities”; ```

This syntax enhancement was also part of JavaScript ES2020. C# and Java handle module exports differently, usually through namespaces and packages. Python's module system uses `import` and `from` statements, but nothing akin to TypeScript's re-export syntax.

  1. Top-Level `await`

TypeScript 3.8 introduced support for top-level `await` in ECMAScript modules, allowing asynchronous operations to be performed at the top level of a module.

```typescript const dynamic = await import(“./module.js”); ```

Top-level `await` is a feature of modern JavaScript (ES2020). C# supports `await` in the top-level context with C# 9.0's top-level statements. Java and Python do not support top-level `await` as their module and script execution models differ.

  1. JSDoc Property Modifiers

TypeScript 3.8 improved support for JSDoc comments, specifically allowing property modifiers like `@public`, `@private`, and `@protected` in JSDoc annotations to control visibility in JavaScript files.

```javascript /** @private */ this._internalMethod = function() {}; ```

JSDoc enhancements are specific to JavaScript and TypeScript, as they rely on comments for type information. C#, Java, and Python have built-in keywords for access modifiers and do not use comments for this purpose.

  1. `es2020` Target and Module

With TypeScript 3.8, the compiler added support for targeting `es2020`, allowing developers to leverage the latest ECMAScript features while ensuring the generated JavaScript code is compatible with environments that support ES2020.

```json {

 "compilerOptions": {
   "target": "es2020"
 }
} ```

Targeting specific versions of ECMAScript is unique to JavaScript and TypeScript. C#, Java, and Python versions are managed differently, usually through language level settings in the compiler or runtime.

  1. Faster `watch` Mode

TypeScript 3.8 made significant performance improvements to the compiler's `watch` mode, reducing the time it takes to detect and compile changes in large projects.

Improvements to watch mode efficiency are specific to TypeScript and similar development tools that support incremental compilation or hot reloading. C# and Java IDEs, as well as Python development environments, offer similar features but through different mechanisms.

  1. `–declaration` and `–allowJs`

TypeScript 3.8 allowed `.js` files to be included in a project's compilation context when using the `–declaration` flag to generate `.d.ts` files, facilitating better JavaScript and TypeScript interop.

```bash tsc –declaration –allowJs ```

This feature is specific to TypeScript's ability to generate

type declaration files from JavaScript code, a functionality not present in C#, Java, or Python, as those languages do not have a separate declaration file concept.

  1. Editor Improvements

TypeScript 3.8 introduced several editor improvements, including more accurate type-checking for JavaScript files, better auto-imports, and enhanced rename refactoring across files.

Editor improvements are related to the development environment and not directly comparable to language features in C#, Java, or Python. However, IDEs for these languages continually evolve to offer better refactoring tools, code navigation, and type inference.

  1. Conclusion

TypeScript 3.8 focused on aligning with ECMAScript standards, improving developer tooling, and enhancing language features for better productivity and code management. Through its unique type system, TypeScript offers JavaScript developers robust tools for building scalable and maintainable applications, setting a precedent for static typing in dynamically typed languages. Comparisons with C#, Java, and Python highlight TypeScript's role in bringing static type advantages to the flexible world of JavaScript, enhancing the development experience while maintaining compatibility with the evolving ECMAScript standards.


TypeScript Version History: TypeScript, JavaScript. TypeScript 4.7 (2022), TypeScript 4.6 (2022), TypeScript 4.5 (2021), TypeScript 4.4 (2021), TypeScript 4.3 (2021), TypeScript 4.2 (2021), TypeScript 4.1 (2020), TypeScript 4.0 (2020), TypeScript 3.9 (2020), TypeScript 3.8 (2020), TypeScript 3.7 (2019), TypeScript 3.6 (2019), TypeScript 3.5 (2019), TypeScript 3.4 (2019), TypeScript 3.3 (2019), TypeScript 3.2 (2018), TypeScript 3.1 (2018), TypeScript 3.0 (2018), TypeScript 2.9 (2018), TypeScript 2.8 (2018), TypeScript 2.7 (2018), TypeScript 2.6 (2017), TypeScript 2.5 (2017), TypeScript 2.4 (2017), TypeScript 2.3 (2017), TypeScript 2.2 (2017), TypeScript 2.1 (2016), TypeScript 2.0 (2016), TypeScript 1.8 (2016), TypeScript 1.7 (2015), TypeScript 1.6 (2015), TypeScript 1.5 (2015), TypeScript 1.4 (2015), TypeScript 1.3 (2014), TypeScript 1.1 (2013), TypeScript 1.0 (2012). (navbar_typecript_versions - see also navbar_typescript, navbar_javacript_versions

TypeScript: TypeScript Glossary, TypeScript Best Practices, Web Development Best Practices, JavaScript Best Practices, TypeScript Fundamentals, TypeScript Inventor - TypeScript Language Designer: Anders Hejlsberg of Microsoft on October 1, 2012; TypeScript Keywords, TypeScript Built-In Data Types, TypeScript Data Structures - TypeScript Algorithms, TypeScript Syntax, TypeScript on Linux, TypeScript on macOS, TypeScript on Windows, TypeScript on Android, TypeScript on iOS, TypeScript Installation, TypeScript Containerization (TypeScript with Docker, TypeScript with Podman, TypeScript and Kubernetes), TypeScript OOP - TypeScript Design Patterns, Clean TypeScript - TypeScript Style Guide, TypeScript Best Practices - TypeScript BDD, Web Browser, Web Development, HTML-CSS, TypeScript Frameworks (Angular), JavaScript Libraries (React.js with TypeScript, Vue.js with TypeScript, jQuery with TypeScript), TypeScript on the Server (TypeScript with Node.js, TypeScript with Deno, TypeScript with Express.js), TypeScript Compiler (tsc, tsconfig.json), TypeScript Transpiler (Transpile TypeScript into JavaScript), Babel and TypeScript, TypeScript Package Management, NPM and TypeScript, NVM and TypeScript, Yarn Package Manager and TypeScript, TypeScript IDEs (Visual Studio Code, Visual Studio, JetBrains WebStorm), TypeScript Development Tools, TypeScript Linter, TypeScript Debugging (Chrome DevTools, JavaScript Source Maps), TypeScript Testing (TypeScript TDD, Selenium, Jest, Mocha.js, Jasmine, Tape Testing (tap-producing test harness for Node.js and browsers), Supertest, React Testing Library, Enzyme.js React Testing, Angular TestBed), TypeScript DevOps - TypeScript SRE, TypeScript Data Science - TypeScript DataOps, TypeScript Machine Learning, TypeScript Deep Learning, Functional TypeScript, TypeScript Concurrency (WebAssembly - WASM) - TypeScript Async (TypeScript Await, TypeScript Promises, TypeScript Workers - Web Workers, Service Workers, Browser Main Thread), TypeScript Concurrency, TypeScript History, TypeScript Bibliography, Manning TypeScript Series, TypeScript Glossary, TypeScript T, TypeScript Courses, TypeScript Standard Library, TypeScript Libraries, TypeScript Frameworks (Angular), TypeScript Research, JavaScript, TypeScript GitHub, Written in TypeScript, TypeScript Popularity, TypeScript Awesome, TypeScript Versions. (navbar_typescript - see also navbar_javascript, navbar_javascript_libraries, navbar_typescript_libraries, navbar_typescript_versions, navbar_typescript_standard_library, navbar_typescript_libraries, navbar_typescript_reserved_words, navbar_typescript_functional, navbar_typescript_concurrency, navbar_typescript_async, navbar_javascript_standard_library, navbar_react.js, navbar_angular, navbar_vue, navbar_javascript_standard_library, navbar_web_development)


© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


typescript_3.8.txt · Last modified: 2024/04/28 03:13 by 127.0.0.1