styles typing (auto-completion, validation)
See original GitHub issueFrom @caub on March 29, 2018 9:25
I think many of us would like to have syntax highlighting, validation, … for the styles
I’ll talk about VSCode, sorry about other editors, styled-components have https://github.com/styled-components/vscode-styled-components
It should be possible to do it, but more using React definitions:
And trigger it for a
const styles = {
foo: {
alignItems: '...'
}
};
@visioncan did something interesting: https://github.com/visioncan/vscode-jss-snippets, but I think I’d prefer that it behaves like React inline styles
Copied from original issue: cssinjs/react-jss#218
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Types Of Validation with AutoComplete TextBoxes - CodeProject
Today I will show you types of validtaion with different styles which can be done with Textboxes. Here I had also used autocomplete...
Read more >CSS autofill and validation - javascript - Stack Overflow
When it changes to just "Test", it is invalidated by pattern and causes the CSS to trigger. This means that you can use...
Read more >Angular Autocomplete Validation - StackBlitz
Angular Material autocomplete option validation.
Read more >HTML attribute: autocomplete - MDN Web Docs
The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide automated assistance in ...
Read more >Blazor AutoComplete Demos - Validation - Telerik
The Telerik Blazor AutoComplete supports validation and responds to changes in EditContext . It is easily integrated with TelerikForm and Blazor EditForms ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello. I was rather surprised to find out that this hasn’t been implemented considering the claim that there is “first-class support for typescript.”
It seems to me that this has already been solved by Material UI’s
createStyles
which doesn’t do anything except help the typechecker along. Is there a reason this hasn’t been added to jss?I ended up re-declaring the function
createUseStyles
using types from @material-ui/styles/withStyles. This allows to pass the styles object tocreateUseStyles
without declaring a variable first.Use:
One caveat though: classes are not inferred when passing the generic type “argument” (here
<{ foo: boolean, bar: number }>
), which means if you doconst { nonExistingClass } = useStyles({ foo, bar });
tsc will not complain.If you do not pass the generic type argument (ex if you do not use functional CSS properties in your style object) then classes are correctly inferred and you will get the error.