-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Flags are not working with typescript ^4.1.3 #172
Comments
Try: const options = {
flags: {
rainbow: {
type: 'boolean',
alias: 'r'
}
}
} as const;
meow(`...`, options) or putting the object literal inline. |
Thanks for the very fast response. I've taken a look and I can confirm that: The first option of using The second option of passing the options inline does remove that type error, however I'm not getting a typed interface on the return meow object. The problem with the second option though is that you can't then use the options outside of that function call. |
Would it be an option to export the options type and then use that when defining my options object e.g, import { Options } from 'meow'
const options: Options = {
flags: {
rainbow: {
type: 'boolean',
alias: 'r'
}
} |
Make sure you're on the latest TS version. |
I'm currently using 4.1.3 |
This passes: a0ce744 |
What version of typescript are you using to test types? I wasn't sure after looking at the package.json |
Also I check that it isn't a case of my IDE not respecting const assertions |
So I tried again using the const assertions approach and I was getting the same type errors. |
TS 4.1.2 |
Thanks for your help. I'm not sure why i'm getting such a different result. For now I've stubbed out the types for the library to get it working in my project. |
The root cause is Since meow@10.0.0, we moved our package to ESM. I will help create-ink-app move their package to ESM. It will take some time because there are some blocking dependencies that need to be moved to ESM as well. Before that, you could downgrade your Update: |
os: windows10
node: v10.15.1
terminal: WSL
The text was updated successfully, but these errors were encountered: