Skip to content

[pull] main from enyo:main - #13

Merged
pull[bot] merged 10 commits into
AKJUS:mainfrom
enyo:main
Sep 16, 2026
Merged

pull[bot] merged 10 commits into
AKJUS:mainfrom
enyo:main

Conversation

@pull

@pull pull Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

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 : )

enyo and others added 10 commits September 16, 2026 18:52
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
`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
@pull pull Bot locked and limited conversation to collaborators Sep 16, 2026
@pull pull Bot added the ⤵️ pull label Sep 16, 2026
@pull
pull Bot merged commit 5a8642c into AKJUS:main Sep 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant