Skip to content

TypeScript 5.0 support #196

Closed
Closed
@Sheraff

Description

@Sheraff

Describe the bug
Upgrading to TS version 5.0.0-beta this extension seems to break. So I know this is a beta version but it's the proper time to adjust libraries so they're compatible on launch.

Here's styles's type under v5:

(alias) const styles: {
    readonly [key: string]: string;
}
import styles

To Reproduce
I have a globals.d.ts with only

declare module "*.module.css"

My tsconfig is nothing out of the ordinary (pasted below) but here's the important bit

    "plugins": [
      { "name": "typescript-plugin-css-modules" }
    ]

And of course, vscode's config contains

"typescript.tsdk": "node_modules/typescript/lib",

And package.json

"typescript-plugin-css-modules": "^4.1.1",

Expected behavior
Changing nothing but the TS version is what breaks the types. I'd love to have it working like under TS v4.9.5. Here's what the exact same styles is typed as under TS 4:

(alias) let styles: {
    'like-slide': string;
    'like-jump': string;
    'dislike-slide': string;
    'dislike-fall': string;
    'reset-slide': string;
    'reset-clip-right': string;
    'reset-clip-left': string;
    ... 33 more ...;
    offline: string;
}
import styles

tsconfig

{
  "compilerOptions": {
    "baseUrl": "./src",
    "target": "ESNext",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "noUncheckedIndexedAccess": true,
    "plugins": [
      { "name": "typescript-plugin-css-modules" }
    ]
  },
  "include": [
    "next-env.d.ts",
    "next-auth.d.ts",
    "**/*.ts",
    "**/*.tsx",
    "**/*.js",
    "globals.d.ts"
  ],
  "exclude": ["node_modules"]
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions