Skip to content

[Bug] Error with arrays and ValidatorFunctions #2

@BastiOfBerlin

Description

@BastiOfBerlin

Hi,

I've got a 'People' model which is simply an array of persons:

People: type: array items: $ref: "#/components/schemas/Person" 

This generates export const PeopleValidators: {[K in keyof People]: Array<ValidatorFn>} = { };, which results in the following transpilation error:

ERROR in src/app/core/generated/api/model/people.ts(30,14): error TS2322: Type '{}' is not assignable to type '{ [x: number]: ValidatorFn[]; length: ValidatorFn[]; toString: ValidatorFn[]; toLocaleString: ValidatorFn[]; pop: ValidatorFn[]; push: ValidatorFn[]; concat: ValidatorFn[]; join: ValidatorFn[]; reverse: ValidatorFn[]; ... 21 more ...; includes: ValidatorFn[]; }'. Property 'length' is missing in type '{}'.

I don't know if simply assigning null instead of empty object conflicts with the form-control-factory, so I didn't try..

I assume that this error will occur with every object that doesn't have own properties.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions