1# Prototype assignment is not supported 2 3Rule ``arkts-no-prototype-assignment`` 4 5**Severity: error** 6 7ArkTS does not support prototype assignment because there is no concept of 8runtime prototype inheritance in the language. This feature is considered not 9applicable to static typing. Mechanism of classes and / or interfaces must 10be used instead to statically "combine" methods to data together. 11 12 13## TypeScript 14 15 16``` 17 18 var C = function(p: number) { 19 this.p = p // Compile-time error only with noImplicitThis 20 } 21 22 C.prototype = { 23 m() { 24 console.log(this.p) 25 } 26 } 27 28 C.prototype.q = function(r: number) { 29 return this.p == r 30 } 31 32``` 33 34## ArkTS 35 36 37``` 38 39 class C { 40 p: number = 0 41 m() { 42 console.log(this.p) 43 } 44 q(r: number) { 45 return this.p == r 46 } 47 } 48 49``` 50 51## See also 52 53- Recipe 132: ``new.target`` is not supported (``arkts-no-new-target``) 54 55 56