13af6ab5fSopenharmony_ci#  Declaring fields in ``constructor`` is not supported
23af6ab5fSopenharmony_ci
33af6ab5fSopenharmony_ciRule ``arkts-no-ctor-prop-decls``
43af6ab5fSopenharmony_ci
53af6ab5fSopenharmony_ci**Severity: error**
63af6ab5fSopenharmony_ci
73af6ab5fSopenharmony_ciArkTS does not support declaring class fields in the ``constructor``.
83af6ab5fSopenharmony_ciDeclare  class fields inside the ``class`` declaration instead.
93af6ab5fSopenharmony_ci
103af6ab5fSopenharmony_ci
113af6ab5fSopenharmony_ci## TypeScript
123af6ab5fSopenharmony_ci
133af6ab5fSopenharmony_ci
143af6ab5fSopenharmony_ci```
153af6ab5fSopenharmony_ci
163af6ab5fSopenharmony_ci    class Person {
173af6ab5fSopenharmony_ci        constructor(
183af6ab5fSopenharmony_ci            protected ssn: string,
193af6ab5fSopenharmony_ci            private firstName: string,
203af6ab5fSopenharmony_ci            private lastName: string
213af6ab5fSopenharmony_ci        ) {
223af6ab5fSopenharmony_ci            this.ssn = ssn
233af6ab5fSopenharmony_ci            this.firstName = firstName
243af6ab5fSopenharmony_ci            this.lastName = lastName
253af6ab5fSopenharmony_ci        }
263af6ab5fSopenharmony_ci
273af6ab5fSopenharmony_ci        getFullName(): string {
283af6ab5fSopenharmony_ci            return this.firstName + " " + this.lastName
293af6ab5fSopenharmony_ci        }
303af6ab5fSopenharmony_ci    }
313af6ab5fSopenharmony_ci
323af6ab5fSopenharmony_ci```
333af6ab5fSopenharmony_ci
343af6ab5fSopenharmony_ci## ArkTS
353af6ab5fSopenharmony_ci
363af6ab5fSopenharmony_ci
373af6ab5fSopenharmony_ci```
383af6ab5fSopenharmony_ci
393af6ab5fSopenharmony_ci    class Person {
403af6ab5fSopenharmony_ci        protected ssn: string
413af6ab5fSopenharmony_ci        private firstName: string
423af6ab5fSopenharmony_ci        private lastName: string
433af6ab5fSopenharmony_ci
443af6ab5fSopenharmony_ci        constructor(ssn: string, firstName: string, lastName: string) {
453af6ab5fSopenharmony_ci            this.ssn = ssn
463af6ab5fSopenharmony_ci            this.firstName = firstName
473af6ab5fSopenharmony_ci            this.lastName = lastName
483af6ab5fSopenharmony_ci        }
493af6ab5fSopenharmony_ci
503af6ab5fSopenharmony_ci        getFullName(): string {
513af6ab5fSopenharmony_ci            return this.firstName + " " + this.lastName
523af6ab5fSopenharmony_ci        }
533af6ab5fSopenharmony_ci    }
543af6ab5fSopenharmony_ci
553af6ab5fSopenharmony_ci```
563af6ab5fSopenharmony_ci
573af6ab5fSopenharmony_ci
58