-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
TS error when using imported Command type #1037
Comments
I was not able to reproduce this with typescript 3.6.2 and this program fragment. Someone else might recognise the error, or you could add some more context. |
I have made a minimal repoducible example for this issue: https://github.com/fson/commander-ts-repro. When you compile the code using
|
I also found a workaround: in some cases, the error went away after changing the exported function from an arrow function like this: export default (program: Command) => { to a function expression: export default function(program: Command) { |
Reproduced issue, and workaround, from @fson. (Thanks!) Still trying to make sense of the local namespace pattern being used in the Commander definitions file. |
I've had a go at reworking the TypeScript declaration file and fixed this error, but the changes are tricky. If any TypeScript experts see this then a review of #1081 would be very welcome. |
Fixed in Commander v4, which has been released. |
I was reproducing this again and a historical note. This issue can be reproduced using TypeScript 3.8.3, but is fixed from 3.9.2. |
As described in the example below I cannot use Command type in types definitions because of this error:
Example
The text was updated successfully, but these errors were encountered: