Open leezu2020 opened 2 weeks ago
Hi, there.
Using with toJS and modular, import { ... } from './data-contracts' is disappeared. Without toJS, it seems to be going well.
toJS
modular
import { ... } from './data-contracts'
I don't know why it's fine, doing like below.
// src/translators/javascript.ts ... export class JavascriptTranslator extends Translator { ... translate = async (input) => { const compiled = this.compileTSCode(input); const jsFileName = `${input.fileName}${typescript.Extension.Js}`; const dtsFileName = `${input.fileName}${typescript.Extension.Dts}`; const sourceContent = compiled[jsFileName]; const tsImportRows = input.fileContent .split("\n") .filter((line) => line.startsWith("import ")); const declarationContent = compiled[dtsFileName] .split("\n") .map((line) => { // I commented out this lines. // if (line.startsWith("import ")) { // return tsImportRows.shift(); // } return line; }) .join("\n"); return [ { fileName: input.fileName, fileExtension: typescript.Extension.Js, fileContent: await this.codeFormatter.formatCode(sourceContent), }, { fileName: input.fileName, fileExtension: typescript.Extension.Dts, fileContent: await this.codeFormatter.formatCode(declarationContent), }, ]; }; }
Hi, there.
Using with
toJS
andmodular
,import { ... } from './data-contracts'
is disappeared. WithouttoJS
, it seems to be going well.I don't know why it's fine, doing like below.