-
-
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
update numbro.d.ts to use export = instead of export default #232
update numbro.d.ts to use export = instead of export default #232
Conversation
Hm, strange, |
I don't use TS myself, so I can't really help, sorry 😕 |
@smajl, what module loader are you using? I know that babel and SystemJS do some magic vodoo to hide the differences but this 'feature' is being reconsidered as mentioned here: microsoft/TypeScript#5565 @BenjaminVanRyseghem, in general in ES2016:
As I said some loaders/bundlers hack it arround to make things simpler, but actually they make it more confusing... TS is strict about it an, since numbro.js is not using It works in my machine (TM) and is the same that moment.d.ts is doing: https://github.com/moment/moment/blob/develop/moment.d.ts |
@olmobrutall We are using JSPM = SystemJS, so that might be the case. Anyway I second your change proposal, it's the correct way. 👍 |
@BenjaminVanRyseghem, something missing for this to get merged? |
@olmobrutall me missing time 😄 |
numbro.d.ts
Outdated
export function loadLanguagesInNode(): void; | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one empty line feels enough 😄
fixed :) |
C'mon a little bit of attention, I just want to make your library great again (for TS users) |
Could we release a patch for this? |
@olmobrutall I would love to have more time dedicated to |
We're al in the business of unrecognized and unpayed work in github. The thing is that numbro is currently unusable for me (and probably like half of the TS users) because of a change that only needs to get merged. If you think that maintaining the d.ts file is a big burden because there is no contributor using TS and it is seen as an alien technology, just delete the file and let it evolve independently in DefinitelyTyped. They currently don't accept my pull request there (DefinitelyTyped/DefinitelyTyped#14412) because they think the d.ts is maintained here. |
My pull request was accepted in DefinitelyTyped/DefinitelyTyped#14412 so I close this pull request... |
@olmobrutall Thanks for this one. How did you get around that? |
@roni-frantchi, I moved to numeral.js because parsing problem (parse 100.000 in Europe) and the typescript issues |
Thanks @olmobrutall . @schmuli @brachi-wernick maybe we should consider doing the same. |
@olmobrutall how can I help? |
The parsing problem was when trying to do this:
The same worked with numeral.js unformat method/constructor, but I didn't found the equivalence in numbro.js docs . I didn't bothered to add the issue since you looked busy. |
please add a ticket 😄 I do am busy, but I am not alone, and when I can find some time, it's good to know what to tackle 😄 Edit: I added #261 |
After the fix of the parse problem (just using Any change of this PR to be merged? We have our own copy of the d.ts file so we can live without the merge, but I'm quite sure the current implementation is wrong and will create problems by any other developers using TS. It's also the same that moment or numeral are doing... |
I fine with merging it 😄 But for the record, I have no idea what it's doing 😛 |
So what is the proper way to import numbro using typescript now? |
@bherila no clue 😄 |
@bherila You should be able to use the import * as numbro from 'numbro'; |
It worked @schmuli , thanks! |
in numbro 1.11.0 |
As https://github.com/foretagsplatsen/numbro/blob/develop/dist/numbro.js shows the module is exported as a namespace (
module.exports = numbro;
), but the Typescript .d.ts file was exporting it usingexport default numbro
.This discrepancy makes it impossible to use in TS:
This commit changes numbro.d.ts to use
exports =
that is the correct way of representing the current javascript behaviour.