I am working typescript, trying to pass a value to a new object but I am unclear on the type that it expects and how to properly format the value.
The object is of type MeshData
and the value I am trying to pass the baseObj
parameter, which appears to accept types IBaseObject<ObjectBaseProps>
, IBaseObject<ObjectWithAnimationProps>
, and null
:
export type MeshData = {
initialized: boolean
uuid: string,
baseObj:
IBaseObject<ObjectBaseProps> |
IBaseObject<ObjectWithAnimationProps> |
null,
}
.
export interface ObjectBaseProps extends CompoundProps {
position: {
x: number;
y: number;
z: number;
},
rotation: {
x: number;
y: number;
z: number;
},
scale: {
x: number;
y: number;
z: number;
},
}
When I attempt to pass a value of type IBaseObject<ObjectBaseProps>
however, I get the following error:
‘IBaseObject’ only refers to a type, but is being used as a value
here.
initialized:false,
uuid: uuidv4(),
baseObj: IBaseObject<ObjectBaseProps>({
position: { x: 0, y: 0, z: 0 },
rotation: { x: 0, y: 0, z: 0 },
scale: { x: 0, y: 0, z: 0 },
}),
How can I correctly pass this value? What is wrong here?