Skip to content

Gatsby 3 syntax support #129

Closed
Closed
@mosesoak

Description

@mosesoak

Is your feature request related to a problem? Please describe.

Yes. I'm unable to use your solution with Gatsby 3, which supports:
import { classOne, classTwo } from './styles.module.scss';

and supports but doesn't recommend,

import * as styles from './styles.module.scss';

but no longer supports:

import styles from './styles.module.scss';

At best, after installing the plugin, setting up VS Code as recommended and reloading the project, I've simply gotten string types to show up by doing export = classes; in the d.ts file, export default classes; fails entirely.

Describe the solution you'd like

Ideally I'd like to use Gatsby 3 with its standard gatsby-plugin-sass and scss modules, and be able to both get type hints in VS Code and ideally be able to jump to the definition of the style in the scss file from the component file.

Even more ideal than even this language plugin would be a way to just make this easier for anyone who wants to use Gatsby and scss modules work with Typescript out of the box in VS Code. For example could someone author a VS Code plugin that would solve this? Should we be petitioning Microsoft to somehow make this easier? It's frustrating that such a fundamental technology (css/scss modules + import) is so lacking in official support.

Describe alternatives you've considered

Currently the only solution that partially works is another 3rd-party lib, gatsby-plugin-scss-typescript, which generates individual d.ts files for each scss file. However, that adds quite a bit of clutter to the project, and clicking through does not jump into the class definition, just into the generated type. That said, it successfully adds code hinting.

Additional context

I'm on a PC running VS Code with remote-WSL. While testing out this solution I upgraded to TS 4.3.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions