Enable ts-strict for colorUtil, contextMenuFilter and linkRenderMode (#1313)

* Add types for colorUtil.ts

* Add types for contextMenuFilter

* Add types to linkRenderMode.ts
This commit is contained in:
Björn Söderqvist
2024-10-25 21:42:15 +02:00
committed by GitHub
parent 3a4b36fb31
commit 1dedce5ec6
3 changed files with 13 additions and 17 deletions

View File

@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { memoize } from 'lodash'
type RGB = { r: number; g: number; b: number }
@@ -17,12 +16,11 @@ function rgbToHsl({ r, g, b }: RGB): HSL {
b /= 255
const max = Math.max(r, g, b),
min = Math.min(r, g, b)
let h: number, s: number
let h = 0,
s = 0
const l: number = (max + min) / 2
if (max === min) {
h = s = 0 // achromatic
} else {
if (max !== min) {
const d = max - min
s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
switch (max) {