Currently, there is no way to enable strict object literal check besides the case when we pass the object to the function directly. It would be great to separate options of such builders into a separate interface in order to provide more flexibility for developers in terms of type declarations and at the same time keep our code base type safe
Welcome aboard!
I guess you can write:
const options: {
lines: Vector3[][];
updatable?: boolean;
instance?: Nullable<LinesMesh>;
colors?: Nullable<Color4[][]>;
useVertexAlpha?: boolean;
material?: Material
} = {
...
}
but I agree it is more cumbersome than having a specific type in the first place…
cc @RaananW and @sebavan to decide if this is something we should add (it’s not only line builders that take options but also many others…).
1 Like
I am totally not against it . Makes sense to me.
A small note, TypeScript does allow you to do the following:
type CreateLineOptions = Parameters<typeof CreateLines>[0];
Didn’t know about the Parameters
utility type, looks neat, thanks!
Let me know if you need any help, I would love to contribute to such amazing project
1 Like
If you want to submit the PR, we will be very happy to merge it!