Skip to content

Bloom refs with TypeScript #161

Description

@penx

With the following code:

import type { BloomEffect } from "postprocessing";

import { useFrame } from "@react-three/fiber";
import { Bloom } from "@react-three/postprocessing";
import { useRef } from "react";

const MyBloom = () => {
  const bloom = useRef<typeof BloomEffect | null>(null);
  useFrame((state, delta) => {
    bloom.current.intensity = 2;
  });
  return <Bloom ref={bloom} />
}

I get the following error:

Property 'intensity' does not exist on type 'typeof BloomEffect'.

The code works though - am I doing something wrong or is there an issue with the types?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions