[pull] main from enyo:main - #13
Merged
Merged
Conversation
The option types are derived from `defaultOptions`, so each one is inferred from its default value. `clickable: true` came out as `boolean` and `hiddenInputContainer: "body"` as `string`, neither of which matches what the option documents two lines above it or what Dropzone has always accepted: `clickable` is passed to `getElements`, which takes an element, a CSS selector or an array of those, and `hiddenInputContainer` to `getElement`, which takes an element or a selector. Widen both the way `previewsContainer` already is. This is a declaration fix only -- the unit tests already cover `clickable` as `true`, as a CSS selector, as an element and as an array, and they are untouched. Fixes #2373
`DropzoneOptions` is derived from `defaultOptions`, so every option is typed by whatever its default happens to be. Where a default is narrower than what the option accepts -- `clickable: true` standing in for an element, a selector or an array of those -- the `as` widening in options.ts is the only thing keeping the declaration honest, and nothing in the suite would notice it being dropped. The unit tests cannot: they are JavaScript, and this is a compile-time property. Add test/types, checked by tsc and never emitted. It needs its own tsconfig because the build one is `emitDeclarationOnly` over src, so assertions living under src would ship to dist as declarations of their own; `pnpm build:types` still emits only the four src declarations. Reverting the widening in options.ts now fails `pnpm typecheck` with the four errors from #2373. The `@ts-expect-error` lines assert in the other direction: each one fails the build if it stops being an error, so they also pin the types against being widened to `any`.
Type clickable and hiddenInputContainer as what they accept
Version packages
`splice(indexOf(this), 1)` removes the last element whenever `indexOf` returns -1, so destroying an instance that was already unregistered -- calling `destroy()` twice is enough -- dropped an unrelated, live Dropzone out of `Dropzone.instances`. Refs #2367
`element.tagName` is upper case on HTML elements, so `init()`'s check never matched and `enctype="multipart/form-data"` was never set on a form Dropzone was attached to. `_addFormElementData` spells the same check `"FORM"` and does work. Refs #2367
Two correctness fixes from the #2367 bonus findings
Version packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )