From f23721ab38edec993d38c9a31409bb6a7dab3ee5 Mon Sep 17 00:00:00 2001 From: xiaoxiao719 <74717987+xiaoxiao719@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:28:15 +0800 Subject: [PATCH] Update TS for Functional Programmers.md Modify code example --- .../copy/en/get-started/TS for Functional Programmers.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/documentation/copy/en/get-started/TS for Functional Programmers.md b/packages/documentation/copy/en/get-started/TS for Functional Programmers.md index 9cf3038a53b8..ebed8c9d899d 100644 --- a/packages/documentation/copy/en/get-started/TS for Functional Programmers.md +++ b/packages/documentation/copy/en/get-started/TS for Functional Programmers.md @@ -542,7 +542,7 @@ immutable. The referent is still mutable: ```js const a = [1, 2, 3]; a.push(102); // ): -a[0] = 101; // D: +a[0] = 1; // D: ``` TypeScript additionally has a `readonly` modifier for properties. @@ -574,7 +574,7 @@ as well as special syntax for this type: let a: ReadonlyArray = [1, 2, 3]; let b: readonly number[] = [1, 2, 3]; a.push(102); // error -b[0] = 101; // error +b[0] = 1; // error ``` You can also use a const-assertion, which operates on arrays and @@ -583,7 +583,7 @@ object literals: ```ts let a = [1, 2, 3] as const; a.push(102); // error -a[0] = 101; // error +a[0] = 1; // error ``` However, none of these options are the default, so they are not