We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: 3.3.3
Search Terms: import, typedef, callback jsCheck
I have an issue with importing generic function type declared with @callback in another file.
@callback
Here is example:
In file1.js I've defined generic function with template parameter
// file1.js /** * @template T * @template {Error} E * @callback CallbackWithResult * @param {E|null} error * @param {T} [result] */
And in another file I've imported that declaration
// file2.js /** @typedef {import('./file1').CallbackWithResult} CallbackWithResult */ /** * @param {CallbackWithResult<number>} callback */ function doSomething(callback) { callback(null, 42); }
Attempting to check file2.js gives following errors
file2.js:4:15 - error TS2314: Generic type 'CallbackWithResult' requires 2 type argument(s). 4 /** @typedef {import('./file1').CallbackWithResult} CallbackWithResult */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file2.js:7:12 - error TS2315: Type 'CallbackWithResult' is not generic. 7 * @param {CallbackWithResult<number>} callback ~~~~~~~~~~~~~~~~~~~~~~~~~~
Question is: how to properly import generic declarations without defining another set of template variables?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
TypeScript Version: 3.3.3
Search Terms: import, typedef, callback jsCheck
I have an issue with importing generic function type declared with
@callback
in another file.Here is example:
In file1.js I've defined generic function with template parameter
And in another file I've imported that declaration
Attempting to check file2.js gives following errors
Question is: how to properly import generic declarations without defining another set of template variables?
The text was updated successfully, but these errors were encountered: