Comments (10)
@jcowman2 I think I've fixed it. It was missing a synthetic export. I managed to fix in another library of mine with a hack but somehow never realized it was missing in this library.
Anyway, I've published a new release. It shouldn't be breaking anything (old exports are still the same), but since this is somewhat of a big impact change, it's a new major version: 5.0.0.
Trying your repo with
npm install prando@latest --save
npm run test
Works well with the tests you had that were previously broken.
Can you try again?
from prando.
I've just confirmed, it works in my project now. Thanks so much for the help, @zeh ! 🎉
from prando.
Sorry I missed this earlier! Checking it this week. Weird as I have it working; might be due to my tsconfig settings.
Do you know if import * as Prando from 'prando';
works?
from prando.
I'm running into the same issue. When I try import * as Prando from 'prando';
, I get the following TypeScript error:
Cannot use 'new' with an expression whose type lacks a call or construct signature.
.
from prando.
@jcowman2 @miso440 Do you have a link to any project that causes this error when attempting to import Prando? The reason I'm asking is because I've been unable to replicate it; my own projects that use the package still work with the latest version. I'm thinking this is somehow related to the tsconfig settings, but haven't been able to pinpoint what yet.
from prando.
@zeh Thanks for looking into this. Here's the branch of my project that's failing.
To replicate, clone + install dependencies, then run npm test
. There should be a bunch failing with that same trace.
from prando.
@jcowman2 Thanks man, I'm taking a look.
from prando.
Identified the issue, more or less. It's when using TSC directly or, in your case, ts-node. They try resolving to the main
file of package.json (the UMD export) rather than the module
file (which would be more kosher) then it breaks. The funny thing is, importing the same UMD file through pure JavaScript works fine.
I haven't noticed that before because my standard builds use Webpack or similar packagers, and it works fine there. Apologies.
Still investigating, as it's likely we just need to export the UMD file in a way that is better understood by tsc.
Edit: more investigation: UMD modules with defaults are not properly imported by TypeScript because of this error. Compiling with esModuleInterop
makes it possible to properly import Prando from "prando";
but of course requires a change in every project. Trying to see if there's a way to circumvent that during generation. In general it works with the current bundler (Rollup) with exports: named
for the umd output, but then it breaks on JavaScript.
from prando.
Nice! Thank you for the report and the repro!
from prando.
Closed as this is fixed in v5.0.0.
from prando.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prando.