diff --git a/src/index.ts b/src/index.ts index 9729380..9ad92c5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -242,19 +242,22 @@ export default function typescript(options?: Partial) printDiagnostics(contextWrapper, diagnostics, parsedConfig.options.pretty === true); } - if (result && result.dts) + if (result) { - const key = normalize(id); - declarations[key] = result.dts; - context.debug(() => `${blue("generated declarations")} for '${key}'`); - result.dts = undefined; - } - - if (result && result.map) { - if (pluginOptions.sourceMapCallback) { - pluginOptions.sourceMapCallback(id, result.map); + if (result.dts) + { + const key = normalize(id); + declarations[key] = result.dts; + context.debug(() => `${blue("generated declarations")} for '${key}'`); + result.dts = undefined; + } + + if (result.map) + { + if (pluginOptions.sourceMapCallback) + pluginOptions.sourceMapCallback(id, result.map); + result.map = JSON.parse(result.map); } - result.map = JSON.parse(result.map); } return result;