1# Constructor function type is not supported 2 3Rule ``arkts-no-ctor-signatures-funcs`` 4 5**Severity: error** 6 7ArkTS does not support the usage of the constructor function type. 8Use lambdas instead. 9 10 11## TypeScript 12 13 14``` 15 16 class Person { 17 constructor( 18 name: string, 19 age: number 20 ) {} 21 } 22 type PersonCtor = new (name: string, age: number) => Person 23 24 function createPerson(Ctor: PersonCtor, name: string, age: number): Person 25 { 26 return new Ctor(name, age) 27 } 28 29 const person = createPerson(Person, 'John', 30) 30 31``` 32 33## ArkTS 34 35 36``` 37 38 class Person { 39 constructor( 40 name: string, 41 age: number 42 ) {} 43 } 44 type PersonCtor = (n: string, a: number) => Person 45 46 function createPerson(Ctor: PersonCtor, n: string, a: number): Person { 47 return Ctor(n, a) 48 } 49 50 let Impersonizer: PersonCtor = (n: string, a: number): Person => { 51 return new Person(n, a) 52 } 53 54 const person = createPerson(Impersonizer, "John", 30) 55 56``` 57 58 59