1# Declaring fields in ``constructor`` is not supported 2 3Rule ``arkts-no-ctor-prop-decls`` 4 5**Severity: error** 6 7ArkTS does not support declaring class fields in the ``constructor``. 8Declare class fields inside the ``class`` declaration instead. 9 10 11## TypeScript 12 13 14``` 15 16 class Person { 17 constructor( 18 protected ssn: string, 19 private firstName: string, 20 private lastName: string 21 ) { 22 this.ssn = ssn 23 this.firstName = firstName 24 this.lastName = lastName 25 } 26 27 getFullName(): string { 28 return this.firstName + " " + this.lastName 29 } 30 } 31 32``` 33 34## ArkTS 35 36 37``` 38 39 class Person { 40 protected ssn: string 41 private firstName: string 42 private lastName: string 43 44 constructor(ssn: string, firstName: string, lastName: string) { 45 this.ssn = ssn 46 this.firstName = firstName 47 this.lastName = lastName 48 } 49 50 getFullName(): string { 51 return this.firstName + " " + this.lastName 52 } 53 } 54 55``` 56 57 58