diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Change log
 
+## 0.4.2.0
+
+* Fix TypeScript (A.KeyMap a) instance
+
 ## 0.4.1.0
 
 * Add TypeScript Int16
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
 Now we can use the newly created instances.
 
 ```haskell
->>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclaration (Proxy :: Proxy (D T))
+>>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclarations (Proxy :: Proxy (D T))
 
 type D<T> = "nullary" | IUnary<T> | IProduct<T> | IRecord<T>;
 
diff --git a/aeson-typescript.cabal b/aeson-typescript.cabal
--- a/aeson-typescript.cabal
+++ b/aeson-typescript.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           aeson-typescript
-version:        0.4.1.0
+version:        0.4.2.0
 synopsis:       Generate TypeScript definition files from your ADTs
 description:    Please see the README on Github at <https://github.com/codedownio/aeson-typescript#readme>
 category:       Text, Web, JSON
@@ -83,6 +83,7 @@
       UntaggedTagSingleConstructors
       UnwrapUnaryRecords
       Util
+      Util.Aeson
       Data.Aeson.TypeScript.Formatting
       Data.Aeson.TypeScript.Instances
       Data.Aeson.TypeScript.Internal
@@ -93,17 +94,10 @@
       Data.Aeson.TypeScript.TypeManipulation
       Data.Aeson.TypeScript.Types
       Data.Aeson.TypeScript.Util
-      Live
-      Live2
-      Live3
-      Live4
-      Live5
-      Live6
       Paths_aeson_typescript
   hs-source-dirs:
       test
       src
-      dev
   ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
   build-depends:
       aeson
diff --git a/dev/Live.hs b/dev/Live.hs
deleted file mode 100644
--- a/dev/Live.hs
+++ /dev/null
@@ -1,77 +0,0 @@
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE QuasiQuotes #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE NamedFieldPuns #-}
-{-# LANGUAGE KindSignatures #-}
-{-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-
-module Live where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.Recursive
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Functor.Identity
-import Data.Kind
-import Data.Map
-import Data.Proxy
-import Data.String.Interpolate
-import qualified Data.Text as T
-import Prelude hiding (Double)
-
-
-instance TypeScript Identity where getTypeScriptType _ = "any"
-
-data SingleDE = SingleDE
-instance TypeScript SingleDE where getTypeScriptType _ = [i|"single"|]
-
-data K8SDE = K8SDE
-instance TypeScript K8SDE where getTypeScriptType _ = [i|"k8s"|]
-
-data SingleNodeEnvironment = SingleNodeEnvironment
-  deriving (Eq, Show)
-instance TypeScript SingleNodeEnvironment where getTypeScriptType _ = [i|"single_node_env"|]
-
-data K8SEnvironment = K8SEnvironment
-  deriving (Eq, Show)
-instance TypeScript K8SEnvironment where getTypeScriptType _ = [i|"k8s_env"|]
-
-data Nullable (c :: Type -> Type) x
-data Exposed x
-type family Columnar (f :: Type -> Type) x where
-    Columnar Exposed x = Exposed x
-    Columnar Identity x = x
-    Columnar (Nullable c) x = Columnar c (Maybe x)
-    Columnar f x = f x
-
-type family DeployEnvironment env = result | result -> env where
-  DeployEnvironment SingleNodeEnvironment = SingleDE
-  DeployEnvironment K8SEnvironment = K8SDE
-  DeployEnvironment T = ()
-
--- * The main type
-
-data UserT env f = User {
-  _userDeployEnv  :: Columnar f (DeployEnvironment env)
-  }
-
-data Complex3 k = Complex3 {
-  bulkCommandNoArgKeys :: Map T.Text k
-  } deriving (Show)
-
-
-deriveTypeScript' A.defaultOptions ''UserT (defaultExtraTypeScriptOptions { typeFamiliesToMapToTypeScript = [''DeployEnvironment] })
-
-main :: IO ()
-main = getTypeScriptDeclarationsRecursively (Proxy :: Proxy (UserT T Identity))
-     & formatTSDeclarations
-     & putStrLn
diff --git a/dev/Live2.hs b/dev/Live2.hs
deleted file mode 100644
--- a/dev/Live2.hs
+++ /dev/null
@@ -1,28 +0,0 @@
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-
-module Live2 where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Proxy
-
-       
-data TestT a = TestT {
-  listOfA :: [a]
-  , maybeA :: Maybe a
-  }
-$(deriveTypeScript A.defaultOptions ''TestT)
-
-main :: IO ()
-main = getTypeScriptDeclarations (Proxy :: Proxy (TestT Int))
-     & formatTSDeclarations
-     & putStrLn
diff --git a/dev/Live3.hs b/dev/Live3.hs
deleted file mode 100644
--- a/dev/Live3.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-
-module Live3 where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Proxy
-
-
-data Test = TestBlah {x :: Int, y :: Bool}
-
-$(deriveTypeScript (A.defaultOptions { A.tagSingleConstructors = True }) ''Test)
-
-main :: IO ()
-main = getTypeScriptDeclarations (Proxy @Test)
-     & formatTSDeclarations
-     & putStrLn
diff --git a/dev/Live4.hs b/dev/Live4.hs
deleted file mode 100644
--- a/dev/Live4.hs
+++ /dev/null
@@ -1,33 +0,0 @@
-{-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-
-module Live4 where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.Recursive
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Proxy
-import TestBoilerplate
-
-
-type family DeployEnvironment2 env = result | result -> env
-type instance DeployEnvironment2 SingleNodeEnvironment = SingleDE
-type instance DeployEnvironment2 K8SEnvironment = K8SDE
-type instance DeployEnvironment2 T = ()
-newtype Simple env = Simple (DeployEnvironment2 env)
-$(deriveTypeScript' A.defaultOptions ''Simple (defaultExtraTypeScriptOptions { typeFamiliesToMapToTypeScript = [''DeployEnvironment2] }))
-
-main :: IO ()
-main = getTypeScriptDeclarationsRecursively (Proxy @(Simple T))
-     & formatTSDeclarations
-     & putStrLn
diff --git a/dev/Live5.hs b/dev/Live5.hs
deleted file mode 100644
--- a/dev/Live5.hs
+++ /dev/null
@@ -1,80 +0,0 @@
-{-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeInType #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-{-# LANGUAGE DeriveGeneric #-}
-
-module Live5 where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.Recursive
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Kind as Kind
-import Data.Proxy
-import qualified Data.Text as T
-import Data.Typeable
-import Data.Void
-import GHC.Generics
-import TestBoilerplate
-
-
--- data From = FromServer | FromClient
--- data MethodType = Notification | Request
-
--- data Method (f :: From) (t :: MethodType) where
---   Login :: Method 'FromClient 'Request
---   ReportClick :: Method 'FromClient 'Notification
-
--- instance TypeScript Login where getTypeScriptType _ = "asdf"
--- instance TypeScript ReportClick where getTypeScriptType _ = "fdsa"
-
--- data LoginParams = LoginParams {
---   loginUsername :: T.Text
---   , loginPassword :: T.Text
---   }
--- $(deriveJSONAndTypeScript A.defaultOptions ''LoginParams)
-
-
--- data ReportClickParams = ReportClickParams {
---   reportClickX :: Int
---   , reportClickY :: Int
---   }
--- $(deriveJSONAndTypeScript A.defaultOptions ''ReportClickParams)
-
--- type family MessageParams (m :: Method f t) :: Kind.Type where
---   MessageParams 'Login = LoginParams
---   MessageParams 'ReportClick = ReportClickParams
-
--- data SMethod (m :: Method f t) where
---   SLogin :: SMethod 'Login
---   SReportClick :: SMethod 'ReportClick
-
--- data RequestMessage (m :: Method f 'Request) =
---   RequestMessage {
---     _id :: T.Text
---     , _method :: SMethod m
---     , _params :: MessageParams m
---     }
-
--- data LoginResult = LoginResult { profilePicture :: T.Text }
--- $(deriveJSONAndTypeScript A.defaultOptions ''LoginResult)
-
--- type family ResponseResult (m :: Method f 'Request) :: Kind.Type where
---   ResponseResult 'Login = LoginResult
---   ResponseResult _ = Void
-
--- deriveTypeScript' A.defaultOptions ''RequestMessage (ExtraTypeScriptOptions [''MessageParams])
-
--- -- main :: IO ()
--- -- main = getTypeScriptDeclarationsRecursively (Proxy @(RequestMessage (Method FromClient Request)))
--- --      & formatTSDeclarations
--- --      & putStrLn
diff --git a/dev/Live6.hs b/dev/Live6.hs
deleted file mode 100644
--- a/dev/Live6.hs
+++ /dev/null
@@ -1,39 +0,0 @@
-{-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeInType #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE TypeFamilyDependencies #-}
-{-# LANGUAGE DeriveGeneric #-}
-
-module Live6 where
-
-import Data.Aeson as A
-import Data.Aeson.TypeScript.TH
-import Data.Function
-import Data.Map
-import Data.Proxy
-import Data.Text
-
-
-data Complex a = Product Int a | Unary Int deriving Eq
-
-data Complex2 a = Product2 Int a
-
-data Complex3 k = Complex3 {
-  bulkCommandNoArgKeys :: Map Text k
-  } deriving (Show)
-$(deriveTypeScript defaultOptions ''Complex3)
-
-main :: IO ()
--- main = printThing (Proxy @(BulkCommandNoArg Int))
-main = printThing (Proxy @(Complex3 Double))
-
-printThing x = getTypeScriptDeclarations x
-             & formatTSDeclarations
-             & putStrLn
diff --git a/src/Data/Aeson/TypeScript/Instances.hs b/src/Data/Aeson/TypeScript/Instances.hs
--- a/src/Data/Aeson/TypeScript/Instances.hs
+++ b/src/Data/Aeson/TypeScript/Instances.hs
@@ -136,7 +136,7 @@
 
 #if MIN_VERSION_aeson(2,0,0)
 instance (TypeScript a) => TypeScript (A.KeyMap a) where
-  getTypeScriptType _ = [i|{[k]?: #{getTypeScriptType (Proxy :: Proxy a)}}|]
+  getTypeScriptType _ = [i|{[k: string]: #{getTypeScriptType (Proxy :: Proxy a)}}|]
   getParentTypes _ = L.nub [TSType (Proxy :: Proxy a)]
 #endif
 
diff --git a/test/TestBoilerplate.hs b/test/TestBoilerplate.hs
--- a/test/TestBoilerplate.hs
+++ b/test/TestBoilerplate.hs
@@ -25,6 +25,7 @@
 import Language.Haskell.TH hiding (Type)
 import Test.Hspec
 import Util
+import Util.Aeson
 
 data Unit = Unit
 data OneFieldRecordless = OneFieldRecordless Int
@@ -35,6 +36,7 @@
 data TwoConstructor = Con1 { con1String :: String } | Con2 { con2String :: String, con2Int :: Int }
 data Complex a = Nullary | Unary Int | Product String Char a | Record { testOne :: Int, testTwo :: Bool, testThree :: Complex a} deriving Eq
 data Optional = Optional {optionalInt :: Maybe Int}
+data AesonTypes = AesonTypes { aesonValue :: A.Value, aesonObject :: A.Object }
 
 -- * For testing type families
 
@@ -74,6 +76,7 @@
     deriveInstances ''TwoConstructor
     deriveInstances ''Complex
     deriveInstances ''Optional
+    deriveInstances ''AesonTypes
 
   typesAndValues :: Exp <- [e|[(getTypeScriptType (Proxy :: Proxy Unit), A.encode Unit)
 
@@ -95,10 +98,16 @@
                               , (getTypeScriptType (Proxy :: Proxy (Complex Int)), A.encode (Unary 42 :: Complex Int))
                               , (getTypeScriptType (Proxy :: Proxy (Complex Int)), A.encode (Product "asdf" 'g' 42 :: Complex Int))
                               , (getTypeScriptType (Proxy :: Proxy (Complex Int)), A.encode ((Record { testOne = 3, testTwo = True, testThree = Product "test" 'A' 123}) :: Complex Int))
+
                               , (getTypeScriptType (Proxy :: Proxy Optional), A.encode (Optional { optionalInt = Nothing }))
-                              , (getTypeScriptType (Proxy :: Proxy Optional), A.encode (Optional { optionalInt = Just 1 }))]
-                           |]
+                              , (getTypeScriptType (Proxy :: Proxy Optional), A.encode (Optional { optionalInt = Just 1 }))
 
+                              , (getTypeScriptType (Proxy :: Proxy AesonTypes), A.encode (AesonTypes {
+                                                                                             aesonValue = A.object [("foo" :: A.Key, A.Number 42)]
+                                                                                             , aesonObject = aesonFromList [("foo", A.Number 42)]
+                                                                                             }))
+                              ]|]
+
   declarations :: Exp <- [e|getTypeScriptDeclarations (Proxy :: Proxy Unit)
                          <> getTypeScriptDeclarations (Proxy :: Proxy OneFieldRecordless)
                          <> getTypeScriptDeclarations (Proxy :: Proxy OneField)
@@ -108,6 +117,7 @@
                          <> getTypeScriptDeclarations (Proxy :: Proxy TwoConstructor)
                          <> getTypeScriptDeclarations (Proxy :: Proxy (Complex T))
                          <> getTypeScriptDeclarations (Proxy :: Proxy Optional)
+                         <> getTypeScriptDeclarations (Proxy :: Proxy AesonTypes)
                          |]
 
   tests <- [d|tests :: SpecWith ()
diff --git a/test/Util/Aeson.hs b/test/Util/Aeson.hs
new file mode 100644
--- /dev/null
+++ b/test/Util/Aeson.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE CPP #-}
+
+module Util.Aeson where
+
+#if MIN_VERSION_aeson(2,0,0)
+import qualified Data.Aeson.KeyMap as KM
+
+aesonFromList = KM.fromList
+#else
+import Data.HashMap.Strict as HM
+
+aesonFromList = HM.fromList
+#endif
