Incompatible types when using esm
See original GitHub issueCurrently the exposed types are not usable, when compiling typescript code as esm.
When importing this lib from esm, i need to write import * as simpleGit from 'simple-git';
.
This will cause simpleGit.default
to be the factory, which works.
But the other enum types are not accessable as simpleGit.ResetMode
, instead they are exported via simpleGit.default.ResetMode
.
Trying to use those will cause compilations issues.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Exported types incompatible with ESM when using TypeScript ...
When importing rxjs in a project using TypeScript@next with the "module": "nodenext" (experimental ESM support) it fails to locate the ...
Read more >How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Caveat: The ESM load hook and namespaced exports from CommonJS modules are incompatible. Attempting to use them together will result in an empty...
Read more >Explicit ESM in Node.js with .mjs - DEV Community
The straightforward answer to this is that having different file extensions allows you to be explicit in how you want to run your...
Read more >ts-node - npm
Older versions of typescript are incompatible with @tsconfig/node16 . In those cases we will use an older default configuration. When in doubt, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The next release will contain #708 which enables the ES module imports in the same format as they would appear in TypeScript, ie:
You can follow the release in #709
Hi, the latest version of
simple-git
is now available on npm, published with a major version bump as the packaging has changed to allow for both importing esm and requiring commonjs.There are very few usage changes, so there should be no code change required in order to upgrade from v2.x to v3.x (unless you were using deprecated APIs that had been logging warnings to the console), or were importing from a path other than just
simple-git
.There are notes for the release available in https://github.com/steveukx/git-js/tree/repo-v3.0.3#release-history and examples for ways to import the library in https://github.com/steveukx/git-js/tree/repo-v3.0.3#usage
Please do raise a new issue if you are having any problems using the new version, thanks.