fix(html/minifier): Fix HTML minifier TS types (#9615)
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled

**Description:**

 - `preserveComments` is optional but required in the TS type

 - `removeRedundantAttributes` is an enum and passing a boolean leads to errors

See https://github.com/swc-project/swc/blob/main/crates/swc_html_minifier/src/option.rs#L54

**Related issue:**

 - https://github.com/facebook/docusaurus/pull/10554
This commit is contained in:
Sébastien Lorber 2024-10-06 11:05:16 +02:00 committed by GitHub
parent 2480bb00fc
commit 7b98bb5e93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,10 +16,13 @@ export type Options = {
| "only-metadata";
removeEmptyMetadataElements?: boolean;
removeComments?: boolean;
preserveComments: string[];
preserveComments?: string[];
minifyConditionalComments?: boolean;
removeEmptyAttributes?: boolean;
removeRedundantAttributes?: boolean;
removeRedundantAttributes?:
| "none"
| "all"
| "smart";
collapseBooleanAttributes?: boolean;
normalizeAttributes?: boolean;
minifyJson?: boolean | { pretty?: boolean };