Skip to content

Could not resolve classname if used via "@nest" keyword #163

Closed
@andrey-skl

Description

@andrey-skl

Describe the bug
If modern CSS nesting syntax is used, it classnames are not recognized.

.content {
  display: inline-flex;

  @nest .fullscreen & {
    max-height: 100%;
  }
}

To Reproduce
Steps to reproduce the behavior:

  1. Have a css file with content listed above
  2. Have a postcss set up. Example postcss.config.js:
module.exports = {
  plugins: [
    require('postcss-preset-env')({
      stage: 3,
      features: {
        'nesting-rules': true
      }
    })
  ]
};
  1. Use the typescript-plugin-css-modules plugin with configuration:
      {
        "name": "typescript-plugin-css-modules",
        "options": {
          "customMatcher": "\\.css$",
          "postCssOptions": {
            "useConfig": true
          }
        }
      }
  1. Have a valid usage:
import styles from './styles.module.css';
console.log(styles.fullscreen); // TS2339: Property 'fullscreen' does not exist on type {content: string}

Expected behavior
.fullscreen classname is recognized and useable

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions