Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsickle

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsickle

Transpile TypeScript code to JavaScript with Closure annotations.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
decreased by-54.66%
Maintainers
1
Weekly downloads
 
Created

What is tsickle?

Tsickle is a TypeScript to Closure Compiler transformer that helps in generating Closure-compatible JavaScript from TypeScript code. It is primarily used to bridge the gap between TypeScript and Google's Closure Compiler, enabling advanced optimizations and type-checking.

What are tsickle's main functionalities?

Type Annotations to JSDoc

Tsickle converts TypeScript type annotations into JSDoc comments, which can be understood by the Closure Compiler for type-checking and optimizations.

/* TypeScript Code */
function add(a: number, b: number): number {
  return a + b;
}

/* Transformed JavaScript Code */
/**
 * @param {number} a
 * @param {number} b
 * @return {number}
 */
function add(a, b) {
  return a + b;
}

Closure Compiler Compatibility

Tsickle transforms TypeScript classes and other constructs into a form that is compatible with the Closure Compiler, enabling advanced optimizations.

/* TypeScript Code */
class Example {
  private value: string;
  constructor(value: string) {
    this.value = value;
  }
}

/* Transformed JavaScript Code */
/**
 * @constructor
 * @param {string} value
 */
var Example = function(value) {
  /** @private {string} */
  this.value = value;
};

Type Checking with Closure Compiler

By converting TypeScript types to JSDoc, Tsickle allows the Closure Compiler to perform type-checking on the generated JavaScript code.

/* TypeScript Code */
function greet(name: string): string {
  return 'Hello, ' + name;
}

/* Transformed JavaScript Code */
/**
 * @param {string} name
 * @return {string}
 */
function greet(name) {
  return 'Hello, ' + name;
}

Other packages similar to tsickle

Keywords

FAQs

Package last updated on 02 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc