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] createStyles() does not have smart property hints in the vscode editor

See original GitHub issue
  • This is a v1.x issue (v0.x is no longer maintained).
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

good

Current Behavior

bad

Context

export default function createStyles<K extends string = string>(styles: StyleRules<K>): StyleRules<K>;

Your Environment

Tech Version
Material-UI v1.2.0
TypeScript v2.8.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BrendonSledcommented, Jun 19, 2018

@pelotom using the createStyles(...) function breaks autocomplete inside the CSS properties. Which is the issue outlined above by the OC.

A temporary workaround I’ve found if you want autocomplete on the CSS properties and inferred class keys is to just add CSSProperties to each class key, like so

const styles = (theme) => ({
  root: {...} as CSSProperties,
  rule1: {...} as CSSProperties,
});
...
classes.root; // intellisense enabled
1reaction
pelotomcommented, Jun 19, 2018

@BrendonSled yep, I was just responding to later comments. This seems like maybe an issue worth raising with the TypeScript team? I would think that if the as CSSProperties annotation is sufficient to get autocompletion then it should also work with createStyles.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[TypeScript] createStyles() does not have smart property hints ...
This is a v1.x issue (v0.x is no longer maintained). ... [TypeScript] createStyles() does not have smart property hints in the vscode editor...
Read more >
TypeScript editing with Visual Studio Code
Property type inlay hints show the type of class properties that don't have an explicit type annotation. Setting: typescript.inlayHints.
Read more >
TypeScript Programming with Visual Studio Code
TypeScript in Visual Studio Code. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, and interfaces ......
Read more >
TypeScript tutorial with Visual Studio Code
TypeScript tutorial in Visual Studio Code. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, ...
Read more >
IntelliSense in Visual Studio Code
Visual Studio Code IntelliSense is provided for JavaScript, TypeScript, JSON, HTML, CSS, SCSS, and Less out of the box. VS Code supports word...
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