13af6ab5fSopenharmony_ci# ``typeof`` operator is allowed only in expression contexts 23af6ab5fSopenharmony_ci 33af6ab5fSopenharmony_ciRule ``arkts-no-type-query`` 43af6ab5fSopenharmony_ci 53af6ab5fSopenharmony_ci**Severity: error** 63af6ab5fSopenharmony_ci 73af6ab5fSopenharmony_ciArkTS supports ``typeof`` operator only in the expression context. Using 83af6ab5fSopenharmony_ci``typeof`` to specify type notations is not supported. 93af6ab5fSopenharmony_ci 103af6ab5fSopenharmony_ci 113af6ab5fSopenharmony_ci## TypeScript 123af6ab5fSopenharmony_ci 133af6ab5fSopenharmony_ci 143af6ab5fSopenharmony_ci``` 153af6ab5fSopenharmony_ci 163af6ab5fSopenharmony_ci let n1 = 42 173af6ab5fSopenharmony_ci let s1 = "foo" 183af6ab5fSopenharmony_ci console.log(typeof n1) // "number" 193af6ab5fSopenharmony_ci console.log(typeof s1) // "string" 203af6ab5fSopenharmony_ci let n2: typeof n1 213af6ab5fSopenharmony_ci let s2: typeof s1 223af6ab5fSopenharmony_ci 233af6ab5fSopenharmony_ci``` 243af6ab5fSopenharmony_ci 253af6ab5fSopenharmony_ci## ArkTS 263af6ab5fSopenharmony_ci 273af6ab5fSopenharmony_ci 283af6ab5fSopenharmony_ci``` 293af6ab5fSopenharmony_ci 303af6ab5fSopenharmony_ci let n1 = 42 313af6ab5fSopenharmony_ci let s1 = "foo" 323af6ab5fSopenharmony_ci console.log(typeof n1) // "number" 333af6ab5fSopenharmony_ci console.log(typeof s1) // "string" 343af6ab5fSopenharmony_ci let n2: number 353af6ab5fSopenharmony_ci let s2: string 363af6ab5fSopenharmony_ci 373af6ab5fSopenharmony_ci``` 383af6ab5fSopenharmony_ci 393af6ab5fSopenharmony_ci## See also 403af6ab5fSopenharmony_ci 413af6ab5fSopenharmony_ci- Recipe 001: Objects with property names that are not identifiers are not supported (``arkts-identifiers-as-prop-names``) 423af6ab5fSopenharmony_ci- Recipe 002: ``Symbol()`` API is not supported (``arkts-no-symbol``) 433af6ab5fSopenharmony_ci- Recipe 029: Indexed access is not supported for fields (``arkts-no-props-by-index``) 443af6ab5fSopenharmony_ci- Recipe 059: ``delete`` operator is not supported (``arkts-no-delete``) 453af6ab5fSopenharmony_ci- Recipe 066: ``in`` operator is not supported (``arkts-no-in``) 463af6ab5fSopenharmony_ci- Recipe 144: Usage of standard library is restricted (``arkts-limited-stdlib``) 473af6ab5fSopenharmony_ci 483af6ab5fSopenharmony_ci 49