From 4ca3b8acdf96042a8162ac747a9dc4fe4cf710e6 Mon Sep 17 00:00:00 2001 From: cihatfurkaneken Date: Fri, 25 Jul 2025 17:16:04 +0300 Subject: [PATCH] fix interop obj-literal no-ambiguity rule Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICONV7 Signed-off-by: cihatfurkaneken --- ets2panda/linter/src/lib/TypeScriptLinter.ts | 2 +- ets2panda/linter/test/interop/object_literal_union_type.ets | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 2093833cb6..5307d9a565 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -10311,7 +10311,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } for (const declaration of symbol.declarations ?? []) { - if (!this.tsUtils.isArkts12File(declaration.getSourceFile())) { + if (!this.tsUtils.isArkts12File(declaration.getSourceFile()) && !isStdLibrarySymbol(symbol)) { return true; } } diff --git a/ets2panda/linter/test/interop/object_literal_union_type.ets b/ets2panda/linter/test/interop/object_literal_union_type.ets index 2e730940c3..403b459358 100644 --- a/ets2panda/linter/test/interop/object_literal_union_type.ets +++ b/ets2panda/linter/test/interop/object_literal_union_type.ets @@ -25,4 +25,6 @@ let xyz: X | Y | Z = { name: "xyz" } let ab: A | B = { name: "hello" } // legal -let y: X | Y = { name: "hello" } as Y; // legal \ No newline at end of file +let y: X | Y = { name: "hello" } as Y; // legal + +let res: Record | object[] = {} \ No newline at end of file -- Gitee