Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@babel/preset-typescript
Advanced tools
The @babel/preset-typescript package is a Babel preset for TypeScript, which allows Babel to parse and transform TypeScript code into JavaScript. This enables developers to use TypeScript's static typing features while leveraging Babel's ability to compile modern JavaScript to be compatible with older browsers or environments.
TypeScript Compilation
Compiles TypeScript code to JavaScript by stripping out type annotations and handling TypeScript-specific syntax.
const x: number = 10;
Support for TypeScript Features
Supports various TypeScript features like enums, interfaces, and namespaces, converting them to equivalent JavaScript code.
enum Color { Red, Green, Blue }; let c: Color = Color.Green;
Integration with Babel Toolchain
Easily integrates with the Babel toolchain, allowing TypeScript files to be included in Babel's build process alongside other JavaScript files.
module.exports = { presets: ['@babel/preset-typescript'] };
ts-loader is a TypeScript loader for webpack. It compiles TypeScript to JavaScript before bundling. It differs from @babel/preset-typescript in that it is specifically designed for use with webpack and uses the TypeScript compiler (tsc) directly rather than Babel.
Similar to ts-loader, awesome-typescript-loader is another loader for webpack that compiles TypeScript to JavaScript. It offers features like Babel integration and type checking in a separate process. It is an alternative to ts-loader and provides similar functionality to @babel/preset-typescript but with a focus on webpack integration.
The official TypeScript npm package provides the TypeScript compiler (tsc) which can be used to compile TypeScript files directly without Babel. It is more comprehensive in terms of TypeScript feature support compared to @babel/preset-typescript, which is focused on integrating TypeScript with Babel's ecosystem.
Babel preset for TypeScript.
See our website @babel/preset-typescript for more information or the issues associated with this package.
Using npm:
npm install --save-dev @babel/preset-typescript
or using yarn:
yarn add @babel/preset-typescript --dev
v7.26.0 (2024-10-25)
babel-core
, babel-generator
, babel-parser
, babel-plugin-syntax-import-assertions
, babel-plugin-syntax-import-attributes
, babel-preset-env
, babel-standalone
, babel-types
babel-core
babel-compat-data
, babel-plugin-proposal-regexp-modifiers
, babel-plugin-transform-regexp-modifiers
, babel-preset-env
, babel-standalone
babel-parser
startIndex
parser option (@DylanPiercey)babel-generator
, babel-parser
, babel-plugin-syntax-flow
babel-helpers
, babel-preset-typescript
, babel-runtime-corejs3
import()
in rewriteImportExtensions
(@liuxingbaoyu)babel-generator
, babel-parser
@babel/generator
(@nicolo-ribaudo)babel-core
babel-plugin-proposal-json-modules
, babel-plugin-transform-json-modules
, babel-standalone
proposal-json-modules
to transform-json-modules
(@nicolo-ribaudo)babel-code-frame
, babel-highlight
@babel/highlight
in @babel/code-frame
(@nicolo-ribaudo)babel-generator
, babel-parser
, babel-types
kind
to TSModuleDeclaration
(@liuxingbaoyu)babel-helper-module-transforms
, babel-plugin-transform-modules-commonjs
FAQs
Babel preset for TypeScript.
The npm package @babel/preset-typescript receives a total of 13,369,124 weekly downloads. As such, @babel/preset-typescript popularity was classified as popular.
We found that @babel/preset-typescript demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.