Skip to content
Discussion options

You must be logged in to vote

I figured this out while writing the question, but I thought I'd still ask and answer for people having the same question. Maybe someone else has a better solution?

I used JSX.IntrinsicElements['meshStandardMaterial']:

type BoxProps = {
  materialProps?: JSX.IntrinsicElements['meshStandardMaterial']
}

const Box = (props: BoxProps) => (
  <mesh>
    <boxBufferGeometry />
    <meshStandardMaterial {...props.materialProps} />
  </mesh>
)

// This should trigger type hinting and not cause any typescript errors:
const BlueBox = () => <Box materialProps={{ color: 'blue' }} />

EDIT: POSSIBLY BETTER SOLUTION

vinayakvivek offered the solution (below) of using MeshStandardMaterialProps. Unlike JSX…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vinayakvivek
Comment options

@ChrisCrossCrash
Comment options

@CodyJasonBennett
Comment options

Answer selected by ChrisCrossCrash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants