Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] CylinderGeometryProps type should be extending TruncatedConeGeometryProps #2346

Open
jesperkiledal opened this issue Mar 11, 2025 · 0 comments
Labels

Comments

@jesperkiledal
Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant