From 8ace1b7ae8522ae4cbfd225eecb1465971038c92 Mon Sep 17 00:00:00 2001 From: luckyzeng Date: Sun, 3 Mar 2019 12:41:31 +0800 Subject: [PATCH 1/2] Add params for preset-typescript --- docs/preset-typescript.md | 4 +++- website/versioned_docs/version-7.0.0/preset-typescript.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/preset-typescript.md b/docs/preset-typescript.md index d213c06876..612b470071 100644 --- a/docs/preset-typescript.md +++ b/docs/preset-typescript.md @@ -52,7 +52,9 @@ babel --presets @babel/preset-typescript script.ts ```javascript require("@babel/core").transform("code", { - presets: ["@babel/preset-typescript"], + presets: [ + ["@babel/preset-typescript", { allExtensions: true }] + ] }); ``` diff --git a/website/versioned_docs/version-7.0.0/preset-typescript.md b/website/versioned_docs/version-7.0.0/preset-typescript.md index 997385d6ab..80b6c05ab4 100644 --- a/website/versioned_docs/version-7.0.0/preset-typescript.md +++ b/website/versioned_docs/version-7.0.0/preset-typescript.md @@ -53,7 +53,9 @@ babel --presets @babel/preset-typescript script.ts ```javascript require("@babel/core").transform("code", { - presets: ["@babel/preset-typescript"], + presets: [ + ["@babel/preset-typescript", { allExtensions: true }] + ] }); ``` From c24caa90d0eb0347528e860a0677ef08996745c8 Mon Sep 17 00:00:00 2001 From: luckyzeng Date: Sun, 3 Mar 2019 20:29:03 +0800 Subject: [PATCH 2/2] Use filename instead of allExtension when using preset-typescript in Node api --- docs/preset-typescript.md | 7 ++++--- website/versioned_docs/version-7.0.0/preset-typescript.md | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/preset-typescript.md b/docs/preset-typescript.md index 612b470071..c00099c286 100644 --- a/docs/preset-typescript.md +++ b/docs/preset-typescript.md @@ -50,11 +50,12 @@ babel --presets @babel/preset-typescript script.ts ### Via Node API +Need a filename with ts or tsx suffix + ```javascript require("@babel/core").transform("code", { - presets: [ - ["@babel/preset-typescript", { allExtensions: true }] - ] + presets: ["@babel/preset-typescript"], + filename: "example.ts" }); ``` diff --git a/website/versioned_docs/version-7.0.0/preset-typescript.md b/website/versioned_docs/version-7.0.0/preset-typescript.md index 80b6c05ab4..ba43b52e58 100644 --- a/website/versioned_docs/version-7.0.0/preset-typescript.md +++ b/website/versioned_docs/version-7.0.0/preset-typescript.md @@ -51,11 +51,12 @@ babel --presets @babel/preset-typescript script.ts ### Via Node API +Need a filename with ts or tsx suffix + ```javascript require("@babel/core").transform("code", { - presets: [ - ["@babel/preset-typescript", { allExtensions: true }] - ] + presets: ["@babel/preset-typescript"], + filename: "example.ts" }); ```