-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Import in typescript #16
Comments
I believe this is to be expected. Unlike By the way, it is probably better to write: import ky = require('ky-universal'); My understanding is that |
Hi @sholladay, Thank you for quick response. import ky = require('ky-universal') This way shows me only "ky.default.post" path in hints in vscode and works incorrectly because ky-universal exported object that doesn't have the "default" field and app crashed in runtime. If I don't use the "default" field it shows error with compiling and linting in TS. My solution is add the definition of "ky-universal" module // ky.d.ts
declare module 'ky-universal' {
import ky from 'ky';
export = ky
} Can we add this definition to fix IDE hits and typescript compiler errors? |
I think this is a problem with our type definition. I think it should be changed to: import ky from 'ky';
export = ky; which is the correct CommonJS syntax. |
Yes, it can be the solution. Should I create PR or would you be able to delegate this change to someone? |
I have submitted PR #17 to fix that issue @ishpartko. After it is merged and released, your workaround should no longer be necessary. |
Hi all,
Don't working default import in ts, like
import ky from 'ky-universal'
is undefiendbut:
is working
The text was updated successfully, but these errors were encountered: