Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect TypeScript types for class with moduleResolution: "nodeNext" #791

Open
tobimori opened this issue Jan 5, 2024 · 2 comments
Open

Comments

@tobimori
Copy link

tobimori commented Jan 5, 2024

Do you want to request a feature or report a bug? bug

What is the current behavior?

CleanShot 2024-01-05 at 14 07 45@2x

import Pusher from "pusher-js"
const pusher = new Pusher("APP_KEY", { cluster: "eu" })

tsconfig

{
  "include": ["**/*.ts", "**/*.tsx"],
  "compilerOptions": {
    "lib": ["DOM", "DOM.Iterable", "ES2022"],
    "isolatedModules": true,
    "esModuleInterop": true,
    "jsx": "react-jsx",
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "resolveJsonModule": true,
    "target": "ES2022",
    "strict": true,
    "noImplicitAny": true,
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./app/*"],
      "@/components": ["app/components/index.ts"],
      "@/state": ["app/utils/state/index.ts"],
      "@/icon-name": ["types/icon-name.d.ts"]
    },
    "skipLibCheck": true,
    "allowImportingTsExtensions": true,
    "noEmit": true
  }
}

What is the expected behavior?

TypeScript would detect te class as expected.

Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?
tested with 8.4, 8.3, 7.6;

@tobimori tobimori changed the title Incorrect TypeScript types for class Incorrect TypeScript types for class with moduleResolution: "nodeNext" Jan 5, 2024
@tobimori
Copy link
Author

tobimori commented Jan 5, 2024

Works fine when removing moduleResolution: "NodeNext"

@discapes
Copy link

Workaround is adding a pusher-js.d.ts file:

declare module "pusher-js" {
	import p from "pusher-js/index.js";
	export default p.default;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants