From 91c4b5515566d7955c910884fcd1465834997e97 Mon Sep 17 00:00:00 2001 From: maczyt <369280416@qq.com> Date: Sat, 18 Mar 2017 14:42:43 +0800 Subject: [PATCH] fix readonly error: ts2540 to ts2450 --- .idea/modules.xml | 8 ++++++++ .idea/typescript-tutorial.iml | 12 ++++++++++++ .idea/vcs.xml | 6 ++++++ basics/type-of-object-interfaces.md | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .idea/modules.xml create mode 100644 .idea/typescript-tutorial.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..be89ef95 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/typescript-tutorial.iml b/.idea/typescript-tutorial.iml new file mode 100644 index 00000000..24643cc3 --- /dev/null +++ b/.idea/typescript-tutorial.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/basics/type-of-object-interfaces.md b/basics/type-of-object-interfaces.md index 956bc773..e1f72622 100644 --- a/basics/type-of-object-interfaces.md +++ b/basics/type-of-object-interfaces.md @@ -174,7 +174,7 @@ let xcatliu: Person = { xcatliu.id = 9527; -// index.ts(14,9): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +// index.ts(14,9): error TS2450: Cannot assign to 'id' because it is a constant or a read-only property. ``` 上例中,使用 `readonly` 定义的属性 `id` 初始化后,又被赋值了,所以报错了。