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

[@sounisi5011/ts-utils-is-property-accessible] can not import from CommonJS TypeScript files #692

Open
sounisi5011 opened this issue May 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sounisi5011
Copy link
Owner

If the type field in package.json is "module", TypeScript will throw the following error:

foo.cts:1:34 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@sounisi5011/ts-utils-is-property-accessible")' call instead.

1 import { isPropAccessible } from '@sounisi5011/ts-utils-is-property-accessible';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think the type field should be "commonjs".

@sounisi5011 sounisi5011 added the bug Something isn't working label May 5, 2023
@sounisi5011
Copy link
Owner Author

I think these problems should be tested automatically with a tool like arethetypeswrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant