Skip to content

JSX autocompletes as class={} instead of class=""Β #62237

@marvinhagemeister

Description

@marvinhagemeister

πŸ”Ž Search Terms

JSX, Preact, autocomplete

πŸ•— Version & Regression Information

  • This changed between versions ______ and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

No response

πŸ’» Code

const a = <div />

πŸ™ Actual behavior

const a = <div class={} />

πŸ™‚ Expected behavior

const a = <div class="" />

Additional information about the issue

https://x.com/adamwathan/status/1953618165042180388

There is so much to love about Preact but the fact that cl(tab) autocompletes to class={} instead of class="" is going to be the death of me 🫠

@_developit
any tricks to get string-ish props to default to empty strings instead of curlies?

I assume this is the TypeScript LSP under the hood doing it? I see it with JSX across frameworks. Super annoying

Yeah, it seems to give me the expected completions in React though (i.e. id="" instead of id={}), think it's the Signalish type in Preact that's causing it.

Type definition in Preact:
https://github.com/preactjs/preact/blob/f3430e0cff27755cff84373e18387aaafdfc7912/src/jsx.d.ts#L1277

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