-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
TypeScript typing problem - numbro.d.ts should not use "export default" #403
Comments
yeah, this affects us too |
Is there any workaround for this? |
@BenjaminVanRyseghem this is still an issue, as exemplified by #435; the changes provided in #430 does not address the original problem reported here. |
in numbro 2.2.0 |
I'm still getting this in 2.2.0 with the following tsconfig: EDIT: |
The TypeScript typing file for
numbro
has recently been changed as follows between versions 2.1.0 and 2.1.1:(Related issue: #352, related PR: #363)
This causes problems if Numbro is being used in a TypeScript project where
tsconfig.json
specifiesmodule: "commonjs"
andtarget: "es5"
. Since the typing file declares thatnumbro
has a default export, TS only accepts the following syntax to import the entire module:However, this transpiles down to the following in ES5:
which is incorrect because the JS code of
numbro
does not have a property nameddefault
- the module exports the entirenumbro
function as the module-level export instead. I believe that the typing file should revert toexport = numbro
to reflect this, or the module itself should includeexports.default = numbro
to provide a default export.The text was updated successfully, but these errors were encountered: