From a2d904d98e5eda633e4769429071deb69980ab82 Mon Sep 17 00:00:00 2001 From: xucheng46 Date: Mon, 11 Dec 2023 23:31:33 +0800 Subject: [PATCH] Add changelog for arkTSVersion Issue: https://gitee.com/openharmony/docs/issues/I8NIT6 Test: NA Signed-off-by: xucheng46 Change-Id: Ie108dbb4fb822e0b3d6af403f1b0374f64febf27 --- .../changelogs-arkcompiler.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 zh-cn/release-notes/changelogs/OpenHarmony_4.1.5.1/changelogs-arkcompiler.md diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.1.5.1/changelogs-arkcompiler.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.1.5.1/changelogs-arkcompiler.md new file mode 100644 index 00000000000..6dcca28b53e --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.1.5.1/changelogs-arkcompiler.md @@ -0,0 +1,65 @@ +# ArkCompiler子系统Changelog + +## cl.ArkCompiler.1 ArkTS语法检查变更 + +**访问级别** +其它 + +**变更原因** +由于TypeScript版本从4.2.3升级到了4.9.5,类型推导与检查能力增强,导致ArkTS语法检查工具需要适配,因此存在部分不兼容之前版本的情况。 + +**变更发生版本** +OpenHarmony SDK 4.1.5.1 + +**变更影响** + +SDK版本升级后,ArkTS语法检查随tsc升级增强,原来能编译成功的历史工程可能会出现新的编译报错 + +**适配指导** + +规则本身没有变化,但以下规则的报错可能会有变化: + +arkts-no-implicit-return-types
+arkts-no-any-unknown
+arkts-strict-typing-required
+arkts-no-structural-typing
+arkts-no-props-by-index
+arkts-no-standalone-this
+arkts-no-func-apply-bind-call
+arkts-no-symbol
+arkts-limited-stdlib
+arkts-no-untyped-obj-literals
+arkts-strict-typing
+ +示例代码1: +```ts +class A {} +class B {} +class C {} + +function f(a1: A | B, a2: A | C) { + a1 = a2; // 会新增报错:Structural typing is not supported (arkts-no-structural-typing) + a2 = a1; // 会新增报错:Structural typing is not supported (arkts-no-structural-typing) +} +``` + +示例代码2: +```ts +declare function foo(); // 会新增报错:Function return type inference is limited (arkts-no-implicit-return-types) +``` + +示例代码3: +```ts +function foo() { + if (this.obj == undefined) { + console.log("no") + } +} +// 升级前后都会报错:Using "this" inside stand-alone functions is not supported (arkts-no-standalone-this) +// 但报错位置会发生变化,之前报错位置在(1,1),现在报错位置在(2,7) +``` + + +不符合ArkTS语法的文件需要进行适配修改,报错规则的具体说明和修改方式请参考[从TypeScript到ArkTS的迁移指导](../../../application-dev/quick-start/typescript-to-arkts-migration-guide.md)。 + +若需要了解ArkTS语言请参考[ArkTS语言简介](../../../application-dev/quick-start/introduction-to-arkts.md)。 \ No newline at end of file -- Gitee