vscode-styled-jsx icon indicating copy to clipboard operation
vscode-styled-jsx copied to clipboard

Syntax highlighting breaks when jsx is explicitly set to `true`

Open IsaiahByDayah opened this issue 6 years ago • 3 comments

We recently changed out project to require explicit values for boolean props and now the great highlighting this plugin provides doesnt work. Looking at the source it seems its a matter of extending this line to account for <style jsx={true}> but could be completely mistaken?

IsaiahByDayah avatar Oct 15 '18 18:10 IsaiahByDayah

I made a PR to potentially fix this: https://github.com/iFwu/vscode-styled-jsx/pull/16

IsaiahByDayah avatar Oct 15 '18 18:10 IsaiahByDayah

I'm currently working on it, and you can temporarily use

{
  "compilerOptions": {
    "jsx": "preserve"
  }
}

in your tsconfig.json or jsconfig.json; and add the following declaration in your typings file.

// custom.d.ts
import 'react';

declare module 'react' {
  interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
    jsx?: boolean;
    global?: boolean;
  }
}

(https://github.com/zeit/styled-jsx/issues/90)

It will eliminate the error in VSCode.

iFwu avatar Nov 01 '18 02:11 iFwu

@iFwu Any progress on this?

dangayle avatar Sep 17 '19 18:09 dangayle