Top-level options passed to StoragePlugin: a union discriminated
on provider, so each backend's options are checked against that backend's
own shape.
The memory arm keeps provider OPTIONAL, so an omitted provider still means
'memory' and StoragePlugin() is unchanged.
Before this was discriminated, one unknown key made the compiler report EVERY
property of the literal as not assignable to type 'never' and never named
the offending one — the union's first member was Record<string, never>,
which accepts any object shape while requiring every property to be never,
so a literal matching no other member bound to it. Discriminating also makes
a missing bucket or containerName a compile error under the arm that
requires it, rather than something only the running backend notices.
Top-level options passed to
StoragePlugin: a union discriminated onprovider, so each backend'soptionsare checked against that backend's own shape.The memory arm keeps
providerOPTIONAL, so an omitted provider still means'memory'andStoragePlugin()is unchanged.Before this was discriminated, one unknown key made the compiler report EVERY property of the literal as
not assignable to type 'never'and never named the offending one — the union's first member wasRecord<string, never>, which accepts any object shape while requiring every property to benever, so a literal matching no other member bound to it. Discriminating also makes a missingbucketorcontainerNamea compile error under the arm that requires it, rather than something only the running backend notices.