-
Notifications
You must be signed in to change notification settings - Fork 995
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
fix: propagate Dictionary including undefined in value type #2393
base: main
Are you sure you want to change the base?
Conversation
Hello, does this pull request actual ? Have the same issue.
|
FIXED BY DOWNGRADE TO v17.7.1 |
This pull request fixes a compile error when building the yargs package itself. It does not affect normal use of the yargs package as a dependency. Example breakage: $ git clone git@github.com:yargs/yargs.git
$ cd yargs
$ npm install
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
> yargs@17.7.2 prepare
> npm run compile
> yargs@17.7.2 compile
> rimraf build && tsc
lib/yargs-factory.ts:667:7 - error TS2345: Argument of type 'string | string[] | Dictionary<string | undefined>' is not assignable to parameter of type 'string | string[] | { [x: string]: string; }'.
Type 'Dictionary<string | undefined>' is not assignable to type 'string | string[] | { [x: string]: string; }'.
Type 'Dictionary<string | undefined>' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.
667 keys,
~~~~
Found 1 error in lib/yargs-factory.ts:667
|
I understand clearly. Thank you for your response. I am waiting for future releases. |
The value type we use with Dictionary type declarations often includes undefined. I am guessing this is more to ensure the value type is checked for a possibly unknown key than for setting a value of undefined, but paranoia is ok for either reason.
TypeScript 5.4.0 picks up a case where the
undefined
was not being used consistently,