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

type checking and auto completion stops working when importing from @react-three/fiber #43311

Closed
Sanderand opened this issue Aug 15, 2024 · 2 comments
Assignees
Labels
component: button This is the name of the generic UI component, not the React module!

Comments

@Sanderand
Copy link

Sanderand commented Aug 15, 2024

Steps to reproduce

Link to live example: (required)
https://stackblitz.com/edit/vitejs-vite-n9k61v?file=src%2Fmain.tsx,src%2FApp.tsx&terminal=dev

Steps:

  1. See line 16: type issue is not recognized on MUI Button component
  2. See line 19: other type issues are recognized
  3. Comment line 2 (import { Canvas } from '@react-three/fiber';) and see that type issue on MUI Button component is not detected

Current behavior

Type checks on MUI components stop working when having imports from @react-three/fiber

Expected behavior

Type checks on MUI components should continue to work when having imports from @react-three/fiber

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
[Version 1.68.137 Chromium: 127.0.6533.100 (Official Build) (64-bit)](https://brave.com/latest/)

  Output from `npx @mui/envinfo` goes here.
❯ npx @mui/envinfo
Need to install the following packages:
@mui/envinfo@2.0.19
Ok to proceed? (y) y

  System:
    OS: Linux 5.0 undefined
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  Browsers:
    Chrome: Not Found
  npmPackages:
    @emotion/react: ^11.13.0 => 11.13.0 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/core-downloads-tracker:  5.16.7 
    @mui/material: ^5.16.7 => 5.16.7 
    @mui/private-theming:  5.16.6 
    @mui/styled-engine:  5.16.6 
    @mui/system:  5.16.7 
    @mui/types:  7.2.15 
    @mui/utils:  5.16.6 
    @types/react: ^18.3.3 => 18.3.3 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 
    typescript: ^5.5.3 => 5.5.4 

Search keywords: type, three, fiber

@Sanderand Sanderand added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 15, 2024
@aarongarciah aarongarciah self-assigned this Aug 15, 2024
@aarongarciah
Copy link
Member

The issue is unrelated to Material UI. Per my testing, TS is working correctly. It rightfully complains about the required bar prop not being present in <Foo />.

Screenshot 2024-08-15 at 12 59 56

I suggest you to download the sandbox and run it locally. Sometimes online sandboxes misbehave and are quite slow at type checking, so always good to double-check locally e.g. type-checking in the Stackblitz sandbox you shared looks like this for a few seconds until all things load:

image

@aarongarciah aarongarciah added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 15, 2024
@Sanderand
Copy link
Author

I can reproduce this locally and provided the Stackblitz as a minimal reproduction example. You are right mentioning that it initially takes some seconds to get the typechecking running. Nevertheless - once it runs - it produces the problems I've mentioned above.

After some more research it seems that this is a known issues that originates from @react-three/fiber, not @mui/material.
#34068 (comment)
#34068 (comment)

So, I guess I just duplicated an existing Github issue. Closing this one. Thanks anyway!

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 15, 2024
@zannager zannager added the component: button This is the name of the generic UI component, not the React module! label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants