-
Notifications
You must be signed in to change notification settings - Fork 309
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
How to import single function for Node / TypeScript #286
Comments
This appears to be a typescript-specific issue, and I do not have experience with the typescript development environment. The ESM tree-shaking is part of this project's test framework, so I know it is working. The test cases uses webpack. Not sure what typescript uses but I think the actual problem is the typescript definition/type file, and I have zero understanding of how that works... |
OK, I'll take it up on DefinitelyTyped I guess, thanks. |
Have you found a solution to this issue? |
Sadly, I fell victim to laziness and just imported * |
I think it's safe to assume this is a DefinitelyTyped issue, as it doesn't (yet) have the individual barcode symbologies configured as exports. |
I would like to include an updated/improved copy of the DefinitelyTyped schema as part of the bwip-js project but am unsure of the etiquette. For those who use typescript, it considered ok to copy the schema (maintaining the current attributions) and make the changes to the project's copy? |
DefinitelyTyped is intended as a fallback for when the project doesn't export the type definitions itself. I'm sure every TS developer would prefer the types in the source repo as it would mean TS support without an additional install. Generally the DefinitelyTyped defs would be removed once this happens.
Assuming the licences are compatible I'd say that's fine. |
Type files are now available in version 4. You can read about them here #299 (comment). |
I'm using
bwip-js
3.3.0 and@types/bwip-js
3.2.0 and generating code128 barcodes on Node 18 (AWS Lambda).I see the documentation says:
But I can't figure out how to get this sort of thing to work from TypeScript:
It doesn't seem to be a valid import. I tried marking up the TypeScript type definitions to declare
code128
the same astoBuffer
and at runtime got an error thatcode128
is not a function.Is this meant to work? If so, any tips?
The text was updated successfully, but these errors were encountered: