Gathering detailed insights and metrics for babel-preset-proposal-typescript
Gathering detailed insights and metrics for babel-preset-proposal-typescript
Gathering detailed insights and metrics for babel-preset-proposal-typescript
Gathering detailed insights and metrics for babel-preset-proposal-typescript
Yet another Babel preset for TypeScript, only transforms proposals which TypeScript does not support now.
npm install babel-preset-proposal-typescript
Typescript
Module System
Min. Node Version
Node Version
NPM Version
48.2
Supply Chain
79.4
Quality
77.7
Maintenance
100
Vulnerability
98.9
License
TypeScript (84.09%)
JavaScript (15.91%)
Total Downloads
181,077
Last Day
25
Last Week
398
Last Month
3,109
Last Year
42,078
26 Stars
120 Commits
2 Forks
3 Watching
11 Branches
6 Contributors
Latest Version
4.0.0
Package Id
babel-preset-proposal-typescript@4.0.0
Unpacked Size
27.88 kB
Size
6.38 kB
File Count
14
NPM Version
10.2.3
Node Version
20.10.0
Publised On
16 Dec 2023
Cumulative downloads
Total Downloads
Last day
-69.9%
25
Compared to previous day
Last week
-42.4%
398
Compared to previous week
Last month
-0.3%
3,109
Compared to previous month
Last year
39.3%
42,078
Compared to previous year
20
2
Yet another Babel preset for TypeScript, only transforms proposals which TypeScript does not support now.
So that you can use babel to transform proposals which are current in stage 0-2 and TypeScript team will not implement them temporarily.
1# yarn 2yarn add -D babel-preset-proposal-typescript 3 4# npm 5npm i -D babel-preset-proposal-typescript
option | description | defaults |
---|---|---|
decoratorsBeforeExport | See Babel Document | undefined |
decoratorsLegacy | Whether to use legacy decorators semantic | true |
importDefer | Whether to enabled import-defer plugin, if true transform-modules-commonjs will be enabled automatically | false |
isTSX | Whether to enable jsx plugin with typescript | false , but true for /\.[jt]sx$/ |
optionalChainingAssignVersion | Version for optional-chaining-assign plugin, only '2023-07' allowed for now | '2023-07' |
pipelineOperator | Implementation of pipeline operator, minimal , smart or fsharp | minimal |
recordTuplePolyfill | Whether to enable import record-tuple plugin and polyfill, or specific the polyfill module name | true for Node>=14.6, it represents @bloomberg/record-tuple-polyfill |
recordTupleSyntaxType | record-tuple syntax, hash or bar | hash |
Note that unlike plugins, the presets are applied in an order of last to first (https://babeljs.io/docs/en/presets/#preset-ordering), so please make sure proposal-typescript
is used at the last.
.babelrc
(Recommended).babelrc
1{ 2 "presets": ["proposal-typescript"] 3}
1babel input.ts --presets proposal-typescript > output.ts
1require('@babel/core').transform('code', { 2 presets: ['proposal-typescript'], 3})
Pipe codes through babel-loader
.
1loader = { 2 test: /\.[jt]sx?$/, 3 loader: 'babel-loader', 4 options: { 5 presets: ['@babel/typescript', 'proposal-typescript'], 6 }, 7} 8 9// if you prefer `ts-loader` or `awesome-typescript-loader` 10loader = { 11 test: /\.tsx?$/, 12 use: [ 13 { 14 loader: 'ts-loader', 15 }, 16 { 17 loader: 'babel-loader', 18 options: { 19 presets: ['proposal-typescript'], 20 }, 21 }, 22 ], 23}
1stG | RxTS | UnTS |
---|---|---|
1stG | RxTS | UnTS |
---|---|---|
Detailed changes for each release are documented in CHANGELOG.md.
No vulnerabilities found.
No security vulnerabilities found.