Skip to content

[Bug] CylinderGeometryProps type should be extending TruncatedConeGeometryProps #2346

@jesperkiledal

Description

@jesperkiledal

Module and/or Feature

CylinderGeometry

Description

It seems that CylinderGeometry should accept all props for TruncatedConeGeometry in addition to the defined CylinderGeometryProps.

// works but triggers a Typescript warning: 
// Object literal may only specify known properties, and 'height' does not exist in type 'CylinderGeometryProps'

new CylinderGeometry({ radius: 1, height: 2 }) 

Suggested solution

// src/geometries/cylinder-geometry.ts

- import {TruncatedConeGeometry} from './truncated-cone-geometry';
+ import {TruncatedConeGeometry, TruncatedConeGeometryProps} from './truncated-cone-geometry';
import {uid} from '../utils/uid';

export type CylinderGeometryProps = {
  id?: string;
  radius?: number;
  attributes?: any;
- };
+ } & TruncatedConeGeometryProps;

export class CylinderGeometry extends TruncatedConeGeometry {
  constructor(props: CylinderGeometryProps = {}) {
    const {id = uid('cylinder-geometry'), radius = 1} = props;
    super({
      ...props,
      id,
      bottomRadius: radius,
      topRadius: radius
    });
  }
}

Expected Behavior

No response

Steps to Reproduce

Environment

Logs

Object literal may only specify known properties, and 'height' does not exist in type 'CylinderGeometryProps'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions