I'm a bit syntactically confused here.
Basically, I my Builder to support an array of a type, rather than a single instance of a type like it did before.
Say we have class x. x has attributes y and z. I want the builder to support building an array of X, and also set the attributes y and z. Is this possible?
x.Builder: IBuilder<x[]>;
constructor () {
this.xBuilder = Builder<x[]>(x[0]); // this already feels incorrect, syntax-wise
}
And later on:
withCertainValues() {
this.xBuilder.y("1"); //incorrect syntax - y isn't directly a property of the Builder, but
//rather of the object in the array that the builder produces, if I'm
//thinking of this correct
this.xBuilder.z("2); //also incorrect
}
I hope this question makes sense. How might I go about achieving this?
Aucun commentaire:
Enregistrer un commentaire