• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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'use static';
16
17import { foo } from "./interop_import_js_rules_js"
18import { ff1, ff2 } from "./interop_import_js_rules_js"
19
20import { A } from "./interop_import_js_rules_js"
21import { C } from "./interop_import_js_rules_js"
22
23import { ff3 } from "./interop_import_js_rules_js"
24
25import { ff4 } from "./interop_import_js_rules_js"
26
27import { handle } from "./interop_import_js_rules_js"
28
29import { expand } from "./interop_import_js_rules_js"
30import { orange } from "./interop_import_js_rules_js"
31
32if (foo.isGood) {}
33
34if (ff1.f1 > 18) {
35  console.log("adult");
36}
37
38class B extends A {}
39let b = new B()
40let c = new B()
41
42class E extends C {} // no autofix+error, handled in different pr
43
44try {
45  ff4()
46} catch (e) {
47  e as number  // 123
48}
49
50let arr = ff3.arr
51let len = arr.length as number
52for (let i = 0; i < len; ++i) {
53  let x = arr[i]
54  arr[i] = 0
55}
56
57interface Person {
58  name: string
59}
60
61function foo2(p: Person) {}
62let lambda = (p: Person) => {}
63
64handle(foo2)
65handle(lambda)
66
67class X{a = 1; b= 2; c= 3}
68expand(new X()) // ERROR expand-static
69
70class Y {
71  str: string = 'str';
72  bool: boolean = false;
73}
74
75let testY: Y = {
76  str: "hello",
77  bool: false,
78}
79
80expand(testY);
81expand({x: '1', y: "hello", z: false});
82
83let flag = false;
84if (orange.isVegetable1 === 123) {
85flag = true
86}
87
88for (let element of arr) {
89  if (element == 8) {
90    console.log("hi");
91  }
92}
93