-
Notifications
You must be signed in to change notification settings - Fork 22
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
Issue with importing specific languages in TypeScript #107
Comments
Thank you for reporting this! This is most likely caused by something in #105. I'm not 100% familiar with TypeScript but I think there are some type file requirements which could be an issue here as well. I'm just not sure why it worked before from source but not anymore. I'll throw the new version in a blank TypeScript project after work and see what I find. In the meantime I found this article which may be helpful - https://askjavascript.com/cannot-find-module-and-its-corresponding-type-declarations/ |
@Sergiobop I could get around this TypeScript issue by preceding the import line with // @ts-ignore
import n2words from 'n2words/i18n/ES'
console.log(n2words) I'll look into providing a proper type definition file for TypeScript users. |
@TylerVigario Great, thank you for your fast response Awesome package btw! |
@Sergiobop We thank you for your kind words! Going to close this for now but will follow up if, and when, I add proper TypeScript definitions. |
@Sergiobop I've gone into further discussion in #109 and created a wiki for importing in TypeScript - https://github.com/forzagreen/n2words/wiki/Importing-in-TypeScript |
Thank you @TylerVigario , i endep up importing the library like this: // @ts-ignore And it's working |
@Sergiobop I've added typings in #112 which is included in |
After upgrading to 1.16.1 i can't import specific languages:
From the wiki:
import n2wordsES from 'n2words/i18n/ES.js'
If i change the import to
import n2wordsES from 'n2words/lib/i18n/ES.js';
Error: Module not found: Error: Package path ./lib/i18n/ES.js is not exported from package node_modules/n2words (see exports field in node_modules/n2words/package.json)
Downgrading to 1.15 since it works as spected:
import n2wordsES from 'n2words/lib/i18n/ES.mjs'
-> Works in 1.15The text was updated successfully, but these errors were encountered: