• 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
16let GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js');
17let Foo = GeneratedImportVar_1.getProperty('Foo');
18let foo = GeneratedImportVar_1.getProperty('foo');
19let CreatePerson = GeneratedImportVar_1.getProperty('CreatePerson');
20let a = GeneratedImportVar_1.getProperty('a');
21let b = GeneratedImportVar_1.getProperty('b');
22let MyNamespace = GeneratedImportVar_1.getProperty('MyNamespace');
23
24
25class Foo1 {}
26
27let foo1 = new Foo1()
28
29if(foo1 instanceof Foo1) {
30
31}
32
33if(foo.isInstanceOf(Foo)) {
34
35}
36
37if(foo1.isInstanceOf(Foo)) {
38
39}
40
41if(foo.isInstanceOf(Foo1)) {
42
43}
44
45let person: CreatePerson = CreatePerson.invoke(ESValue.wrap('xc'), ESValue.wrap(18.0))
46
47if(person.isInstanceOf(CreatePerson)) {
48
49}
50
51function test1(): void {
52    if(person.isInstanceOf(CreatePerson)) {
53
54    }
55}
56
57const test2 = (): void => {
58    if(person.isInstanceOf(CreatePerson)) {
59
60    }
61}
62
63class Test3 {
64    init(): void {
65        if(person.isInstanceOf(CreatePerson)) {
66
67        }
68    }
69}
70
71if(a.isInstanceOf(Array)) {
72
73}
74
75if(b().isInstanceOf(Array)) {
76
77}
78
79const myDog: MyNamespace.Dog = new MyNamespace.getProperty("Dog")('Buddy');
80
81if (myDog.isInstanceOf(MyNamespace.Dog)) {
82  console.log("This is a Dog!");
83}