1#  ``in`` operator is not supported
2
3Rule ``arkts-no-in``
4
5**Severity: error**
6
7ArkTS does not support the operator ``in``. However, this operator makes
8little sense since the object layout is known at compile time, and cannot
9be modified at runtime. Use ``instanceof`` as a workaround if you still need
10to check whether certain class members exist.
11
12
13## TypeScript
14
15
16```
17
18    class Person {
19        name: string = ""
20    }
21    let p = new Person()
22
23    let b = "name" in p // true
24
25```
26
27## ArkTS
28
29
30```
31
32    class Person {
33        name: string = ""
34    }
35    let p = new Person()
36
37    let b = p instanceof Person // true, and "name" is guaranteed to be present
38
39```
40
41## See also
42
43- Recipe 001:  Objects with property names that are not identifiers are not supported (``arkts-identifiers-as-prop-names``)
44- Recipe 002:  ``Symbol()`` API is not supported (``arkts-no-symbol``)
45- Recipe 029:  Indexed access is not supported for fields (``arkts-no-props-by-index``)
46- Recipe 059:  ``delete`` operator is not supported (``arkts-no-delete``)
47- Recipe 060:  ``typeof`` operator is allowed only in expression contexts (``arkts-no-type-query``)
48- Recipe 144:  Usage of standard library is restricted (``arkts-limited-stdlib``)
49
50
51