question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript prop autocomplete not working

See original GitHub issue

Description

When I used any chakra component and specified props, I expected VSCode’s autocomplete to work by showing a subset of the available values (like sizes for Heading), but instead I saw no autocomplete appear and the prop was just typed as string.

Link to Reproduction

https://codesandbox.io/s/chakra-ui-typescript-pomi8 (I think this should do, but since this is specific to VSCode’s autocomplete, it might not be enough, and might need to clone locally and open VSCode to reproduce).

Steps to reproduce

Try to use any chakra component and see the autocomplete not work in VSCode. The TypeScript starter should be enough to reproduce. The project I’m using has "typescript": "^4.7.4" and "@chakra-ui/react": "^2.3.5". I confirmed my tsconfig.json is exactly the same as the example repo.

Chakra UI Version

2.3.5

Browser

N/A

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

I had a project with older TypeScript and chakra versions where the autocomplete was working ("typescript": "^4.3.0" and "@chakra-ui/react": "^1.4.2").

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
aecorredorcommented, Oct 4, 2022

@anubra266 I got this to work. I updated the react type dependencies to match exactly what the codesandbox had. I think some discrepancies in types from older versions caused the issue, especially since react 18.

1reaction
anubra266commented, Oct 4, 2022

@aecorredor Not this?

CleanShot 2022-10-04 at 13 46 11@2x
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript React "props" member autocompletion not working
Here's a screenshot of what VS Code looks like after I type "this.props.". I expect the member variable "name" to appear in the...
Read more >
React props not auto-complete in VS Code - Stack Overflow
React JavaScript won't tell you any required props, and using TypeScript will help you achieve that. Example: type Data = { id: string;...
Read more >
No prop value autocomplete for React+Typescript ... - YouTrack
Autocomplete suggests values from the readonly array. What happens instead? The IDE/Typescript knows the options (shown in the demo by pressing crtl key...
Read more >
Working with JavaScript in Visual Studio Code
Working with JavaScript. This topic describes some of the advanced JavaScript features supported by Visual Studio Code. Using the TypeScript language ...
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested ... the limitTags prop to limit the number of displayed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found