From 2147cefaf9a652fe18437d199d2adc784b636008 Mon Sep 17 00:00:00 2001 From: Jaid Date: Fri, 15 Feb 2019 14:47:07 +0100 Subject: [PATCH] Improved TSD transformation Signed-off-by: Jaid --- src/transformTsd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformTsd.js b/src/transformTsd.js index 7de3a05..d796270 100644 --- a/src/transformTsd.js +++ b/src/transformTsd.js @@ -1,10 +1,10 @@ const moduleBlockRegex = /(declare module [^\n]+)(.+?)(\n})/gs -const moduleFieldRegex = /^([\t ]*)(type|function|interface|var|const|class) +(\w+)/gm +const moduleFieldRegex = /^([\t ]*)(type|function|interface|var|const|class) +(a-zA-Z0-9_\$+)/gm const debug = require("debug")("jsdoc-tsd-webpack-plugin") const transformField = (type, name) => { - if (name === "default") { + if (name === "default" || name === "_default") { return `export default ${type}` } else { return `export ${type} ${name}`