1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17export enum E { 18 str = 'e5' 19} 20 21interface I { 22 one: string, 23 2: string, // ERROR v1.1 24 '3': string, // OK v1.1 rule relax case 25 [E.str]: string; // OK v1.1 rule relax case 26} 27 28let vInterface1: I = { 29 one: 'i1', 30 2: 'i2', // ERROR v1.1 31 '3': 'i3', // OK v1.1 32 [E.str]: 'e5' // OK v1.1 33} 34let vInterface2: I = { 35 one: 'i1', 36 2: 'i2', // ERROR v1.1 37 '3': 'i3', // OK v1.1 38 'e5': 'e5' // OK v1.1 39} 40 41class C { 42 public one?: string = 'c1'; 43 public 3?: string = 'c3'; // ERROR v1.1 44 public '4': string = 'c4'; // OK v1.1 rule relax case 45 public [E.str]: string = 'e5'; // OK v1.1 rule relax case 46} 47 48let vClass1: C = { 49 one: 'c1', 50 3: 'c3', // ERROR v1.1 51 '4': 'c4', // OK v1.1 52 'e5': 'e5' // OK v1.1 53} 54 55let vClass2: C = { 56 one: 'c1', 57 3: 'c3', // ERROR v1.1 58 '4': 'c4', // OK v1.1 59 [E.str]: 'e5' // OK v1.1 60}