fix: URLParams typing in demo with new diffTooBigMessage option

This commit is contained in:
Pierric Cistac 2021-02-25 15:21:25 -05:00
parent 9aa2ea924e
commit b057c6f308
No known key found for this signature in database
GPG key ID: 9D98B3AF93C7362D

View file

@ -21,6 +21,7 @@ import './demo.css';
type URLParams = {
diff?: string;
diffTooBigMessage?: string;
[key: string]: string | boolean | number | undefined;
};
@ -116,13 +117,13 @@ function prepareRequest(url: string): Request {
}
function getConfiguration(urlParams: URLParams): Diff2HtmlUIConfig {
// Removing `diff` form `urlParams` to avoid being inserted
// Removing `diff` and `diffTooBigMessage` form `urlParams` to avoid being inserted
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { diff, ...urlParamsRest } = urlParams;
const config: URLParams = {
const { diff, diffTooBigMessage, ...urlParamsRest } = urlParams;
const config = ({
...defaultDiff2HtmlUIConfig,
...urlParamsRest,
};
} as unknown) as URLParams;
return Object.entries(config).reduce((object, [k, v]) => {
const newObject = !Number.isNaN(Number(v))