[@babel/plugin-transform-runtime] Add types (#43617)

This commit is contained in:
Slava Fomin II
2020-04-03 15:28:48 -07:00
committed by GitHub
parent 7d07319135
commit 10cd7dd545
4 changed files with 144 additions and 0 deletions
@@ -0,0 +1,95 @@
/* tslint:disable:no-consecutive-blank-lines comment-format */
import { Options } from '@babel/plugin-transform-runtime';
//========//
// COREJS //
//========//
let options: Options = {
corejs: 2,
};
options = {
corejs: 3,
};
options = {
corejs: {
version: 2,
proposals: true,
},
};
options = {
corejs: {
version: 3,
proposals: false,
},
};
//=========//
// HELPERS //
//=========//
options = {
helpers: true,
};
options = {
helpers: false,
};
//=============//
// REGENERATOR //
//=============//
options = {
regenerator: true,
};
options = {
regenerator: false,
};
//================//
// USE ES MODULES //
//================//
options = {
useESModules: true,
};
options = {
useESModules: false,
};
//==================//
// ABSOLUTE RUNTIME //
//==================//
options = {
absoluteRuntime: true,
};
options = {
absoluteRuntime: false,
};
options = {
absoluteRuntime: '/some/path/here',
};
//=========//
// VERSION //
//=========//
options = {
version: '^1.2.3',
};
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for @babel/plugin-transform-runtime 7.9
// Project: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime, https://babeljs.io/docs/en/babel-plugin-transform-runtime
// Definitions by: Slava Fomin II <https://github.com/slavafomin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Options {
corejs?: CorejsOption;
helpers?: boolean;
regenerator?: boolean;
useESModules?: boolean;
absoluteRuntime?: (boolean | string);
version?: string;
}
export type CorejsOption = (
| CorejsVersion
| { version: CorejsVersion, proposals: boolean }
| false
);
export type CorejsVersion = (2 | 3);
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@babel/plugin-transform-runtime": [
"babel__plugin-transform-runtime"
]
}
},
"files": [
"index.d.ts",
"babel__plugin-transform-runtime-tests.ts"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}