From 46e804b5cf9f59c7f546bb96f08786cfed005624 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 23 Aug 2020 09:00:16 -0400 Subject: [PATCH] And that --- packages/react-dock/src/autoprefix.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-dock/src/autoprefix.ts b/packages/react-dock/src/autoprefix.ts index f4c57d16..07eaa4e2 100644 --- a/packages/react-dock/src/autoprefix.ts +++ b/packages/react-dock/src/autoprefix.ts @@ -1,6 +1,8 @@ // Same as https://github.com/SimenB/react-vendor-prefixes/blob/master/src/index.js, // but dumber +import { CSSProperties } from 'react'; + const vendorSpecificProperties = [ 'animation', 'animationDelay', @@ -34,8 +36,8 @@ const vendorSpecificProperties = [ const prefixes = ['Moz', 'Webkit', 'ms', 'O']; -function prefixProp(key, value) { - return prefixes.reduce( +function prefixProp(key: string, value: Value) { + return prefixes.reduce<{ [key: string]: Value }>( (obj, pre) => ( (obj[pre + key[0].toUpperCase() + key.substr(1)] = value), obj ), @@ -43,13 +45,13 @@ function prefixProp(key, value) { ); } -export default function autoprefix(style) { +export default function autoprefix(style: CSSProperties) { return Object.keys(style).reduce( (obj, key) => vendorSpecificProperties.indexOf(key) !== -1 ? { ...obj, - ...prefixProp(key, style[key]), + ...prefixProp(key, style[key as keyof CSSProperties]), } : obj, style