diff --git a/distributed-closure.cabal b/distributed-closure.cabal
--- a/distributed-closure.cabal
+++ b/distributed-closure.cabal
@@ -1,5 +1,5 @@
 name:                distributed-closure
-version:             0.3.5
+version:             0.4.0
 synopsis:            Serializable closures for distributed programming.
 description:         See README.
 homepage:            https://github.com/tweag/distributed-closure
diff --git a/src/Control/Distributed/Closure/TH.hs b/src/Control/Distributed/Closure/TH.hs
--- a/src/Control/Distributed/Closure/TH.hs
+++ b/src/Control/Distributed/Closure/TH.hs
@@ -13,7 +13,7 @@
   , withStatic
   ) where
 
-import           Control.Monad (replicateM)
+import           Control.Monad (replicateM, unless)
 import           Control.Distributed.Closure
 import           Data.Generics (everything, mkQ)
 import           Data.List (nub)
@@ -96,6 +96,13 @@
 withStatic :: TH.DecsQ -> TH.DecsQ
 withStatic = (>>= go)
   where
+    checkExtension :: TH.Extension -> TH.Q ()
+    checkExtension ext = do
+      enabled <- TH.isExtEnabled TH.ScopedTypeVariables
+      unless enabled $
+        fail $ "withStatic requires the language extension " ++ show ext
+
+    go :: [TH.Dec] -> TH.DecsQ
     go [] = return []
 #if MIN_VERSION_template_haskell(2,11,0)
     go (ins@(TH.InstanceD overlap cxt hd _):decls) = do
@@ -117,11 +124,14 @@
                               : replicate n [| closureDict |]
                               )))
             []
-        staticcxt <- (++) <$>
+        typeableConstraints <-
           sequence [ [t| Typeable $(return d) |]
                    | d <- retsig : dictsigs
                    , not (null (fvT d))
-                   ] <*>
+                   ]
+        unless (null typeableConstraints) $
+          checkExtension TH.ScopedTypeVariables
+        staticcxt <- (typeableConstraints ++) <$>
           mapM (\c -> [t| Static   $(return c) |]) cxt
         statichd <- [t| Static $(return hd) |]
 #if MIN_VERSION_template_haskell(2,11,0)
diff --git a/tests/test.hs b/tests/test.hs
--- a/tests/test.hs
+++ b/tests/test.hs
@@ -5,6 +5,7 @@
 {-# LANGUAGE StaticPointers #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
 
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 
@@ -21,11 +22,17 @@
 import Test.QuickCheck
 
 data T a = T a
+data T1 a b = T1 a b
+data T2 = T2
 
+type family F a
+
 -- Test that the result of this splice compiles.
 withStatic [d|
   instance Show a => Show (T a) where show = undefined
   instance (Eq a, Show a) => Eq (T a) where (==) = undefined
+  instance Show (F a) => Show (T1 a b) where show = undefined
+  instance Show T2 where show = undefined
   |]
 
 -- * Basic generators (parameterized by size)
