-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
error importing default function from ambient module #7554
Comments
@bcherny That type definition is incorrect according to the source code, it should be Once you're using |
thanks for clarifying - this makes sense!
this syntax is a bit awkward, since it's using the same keywords as es6, but with different meaning. |
Yes, I know 😄 But there's no equivalent for |
actually, with the it's a 3rd party module - what do you suggest? |
Use |
the import compiles, but the export fails to compile. i also can't seem to find a relevant example anywhere. new import: import getCaretCoordinates = require('textarea-caret') new export: declare module 'textarea-caret' {
export = function getCaretCoordinates( // syntax appears to be wrong
element: HTMLElement,
position: number,
options?: {debug?: boolean}
): {left: number, top: number}
} |
I know this is an old issue, and probably solved, but if maybe the following is helpful to others.
|
@blakeembrey @PAStheLoD Thanks. I have this issue too. It works. Is there some documents about I know what's But I am confused about when to use If there is a |
lib:
https://www.npmjs.com/package/textarea-caret
typing (in textarea-caret.d.ts):
consuming it (in app.ts):
the function call fails to compile, throwing
Error TS2349: Cannot invoke an expression whose type lacks a call signature
.changing the import to
import getCaretCoordinates from 'textarea-caret'
fixes the issue.per the es6 module syntax, it seems that the original version is the correct one, right?
The text was updated successfully, but these errors were encountered: