Created
October 3, 2022 18:51
-
-
Save mkczarkowski/899f8424e7a959520a4a48e45aeac92f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Colors = "red" | "green" | "blue"; | |
type HSL = [hue: number, saturation: string, lightness: string]; | |
type ColorPalette = Record<Colors, string | HSL> | |
const palette = (): Promise<ColorPalette> => new Promise((resolve, reject) => { | |
resolve({ | |
red: [0, '100%', '50%'], | |
green: "#00ff00", | |
blue: [240, '100%', '50%'] | |
}) | |
}); | |
const justAPalette = await palette() satisfies ColorPalette; | |
const blueHslCssFunction = `hsl(${justAPalette.blue.join('')})` // Property 'join' does not exist on type 'string | HSL'. | |
// Property 'join' does not exist on type 'string'.ts(2339) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment