From 7d6ab0dbe15c40f29c165328974c3a89f4583798 Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Wed, 18 May 2022 16:31:31 +0800 Subject: [PATCH] distinguish dts file between user and program Signed-off-by: zhangrengao Change-Id: I3cb08de1b3af44431b284c7ff61dee290ad65fa3 --- ts2panda/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts2panda/src/index.ts b/ts2panda/src/index.ts index bc5881e33a..adabde3712 100644 --- a/ts2panda/src/index.ts +++ b/ts2panda/src/index.ts @@ -57,7 +57,8 @@ function main(fileNames: string[], options: ts.CompilerOptions) { if (CmdOptions.needRecordDtsType()) { for (let sourceFile of program.getSourceFiles()) { - if (sourceFile.isDeclarationFile && !program.isSourceFileDefaultLibrary(sourceFile)) { + let originFileNames = new Set(fileNames.slice(0, fileNames.length - dtsFiles.length)); + if (sourceFile.isDeclarationFile && !program.isSourceFileDefaultLibrary(sourceFile) && originFileNames.has(sourceFile.fileName)) { setGlobalDeclare(checkIsGlobalDeclaration(sourceFile)); generateDTs(sourceFile, options); } -- Gitee