You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ra...@apache.org on 2020/07/26 23:54:19 UTC

[incubator-annotator] 08/09: Set @babel/typescript options

This is an automated email from the ASF dual-hosted git repository.

randall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit f4c41fc3412c2c1a3ac4892b6383923286d104f2
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Fri Jul 24 18:21:16 2020 -0700

    Set @babel/typescript options
---
 babel.config.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/babel.config.js b/babel.config.js
index 0daad76..8f358f4 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -32,6 +32,14 @@ module.exports = (api) => {
     targets: 'defaults',
   };
 
+  // Options for the @babel/typescript preset.
+  const typescriptOptions = {
+    // Opt in to a Babel 8 default.
+    allowDeclareFields: true,
+    // Be explicit about type-only imports.
+    onlyRemoveTypeImports: true,
+  };
+
   // Options for the module-resolver plugin.
   // Used for resolving source files during development.
   let resolverOptions = {
@@ -55,6 +63,9 @@ module.exports = (api) => {
       ...(DEV ? [['module-resolver', resolverOptions]] : []),
       ...(TEST ? ['istanbul'] : []),
     ],
-    presets: [['@babel/env', envOptions], '@babel/preset-typescript'],
+    presets: [
+      ['@babel/env', envOptions],
+      ['@babel/typescript', typescriptOptions],
+    ],
   };
 };