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

Question - CommonJS with TypeScript 5.x and tslog #267

Open
Gittified opened this issue Oct 3, 2023 · 3 comments
Open

Question - CommonJS with TypeScript 5.x and tslog #267

Gittified opened this issue Oct 3, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@Gittified
Copy link

Gittified commented Oct 3, 2023

Recently, CJS has been added to this lib, which I am quite happy with. However, in my current project I'd like to use it with TypeScript where I ran into an issue.

When my IDE (VSCode) checks for module compatibility, it looks into the package.json of the library. Since the /types/ directory is located in the folder that has "type": "module" in the package.json, it will give me a warning that it'll be using ESM. Except this is not the case, when I ts-ignore this error the code transpiles fine:

Without ts-ignore
image

With ts-ignore
image

I can unfortunately not switch to ESM because of my difficult setup with other dependencies, and I am also not a fan of using ts-ignore to solve problems.

Is it an idea to make an import like import { Logger, ILogObj } from "tslog/cjs"; which has typings and "type": "commonjs" in the package.json? Or am I missing something here?

@Gittified Gittified added the enhancement New feature or request label Oct 3, 2023
@mustafababil
Copy link

Is there an update on this matter?

@Gittified
Copy link
Author

Is there an update on this matter?

I just made a simple logger till this is fixed/ someone knows a workaround, but I haven't spent much energy on trying anything since the project above is currently shelved 👍

@Lyoko-Jeremie
Copy link

same issue. any update now ?

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

No branches or pull requests

3 participants