1# Conditional types are not supported 2 3Rule ``arkts-no-conditional-types`` 4 5**Severity: error** 6 7ArkTS does not support conditional type aliases. Introduce a new type with 8constraints explicitly, or rewrite logic using ``Object``. The keyword 9``infer`` is not supported. 10 11 12## TypeScript 13 14 15``` 16 17 type X<T> = T extends number ? T : never 18 19 type Y<T> = T extends Array<infer Item> ? Item : never 20 21``` 22 23## ArkTS 24 25 26``` 27 28 // Provide explicit constraints within type alias 29 type X1<T extends number> = T 30 31 // Rewrite with Object. Less type control, need more type checks for safety 32 type X2<T> = Object 33 34 // Item has to be used as a generic parameter and need to be properly 35 // instantiated 36 type YI<Item, T extends Array<Item>> = Item 37 38``` 39 40 41