diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 6ca6c7b0c0043e3bb595c6b798424e61c499546b..5e45edbaeefa976f43e01a53cdffc15b1c41a2f2 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -922,6 +922,12 @@ def Test_extend_dict_item_type()
   END
   CheckDefExecFailure(lines, 'E1012: Type mismatch; expected number but got string', 0)
   CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1)
+
+  lines =<< trim END
+       var d: dict<bool>
+       extend(d, {b: 0})
+  END
+  CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<bool> but got dict<number>', 2)
 enddef
 
 func g:ExtendList(l)
@@ -947,6 +953,12 @@ def Test_extend_list_item_type()
   END
   CheckDefExecFailure(lines, 'E1012: Type mismatch; expected number but got string', 0)
   CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1)
+
+  lines =<< trim END
+       var l: list<bool>
+       extend(l, [0])
+  END
+  CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<bool> but got list<number>', 2)
 enddef
 
 def Test_extend_return_type()
diff --git a/src/version.c b/src/version.c
index ffe37a46025d7fe957a564697716da3f2e8cac84..5b34ac70b20e37ca66a2748f17c54ced1cfe5f1c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3322,
 /**/
     3321,
 /**/
diff --git a/src/vim9type.c b/src/vim9type.c
index d3562e788df101efdde6ac8ca6bb1502550c32da..ca090cbe5905f254057b6fce9d95b43b40b06c9d 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -274,10 +274,12 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
 	list_T	    *l = tv->vval.v_list;
 	listitem_T  *li;
 
-	if (l == NULL || l->lv_first == NULL)
+	if (l == NULL || (l->lv_first == NULL && l->lv_type == NULL))
 	    return &t_list_empty;
 	if (!do_member)
 	    return &t_list_any;
+	if (l->lv_type != NULL)
+	    return l->lv_type;
 	if (l->lv_first == &range_list_item)
 	    return &t_list_number;
 	if (l->lv_copyID == copyID)
@@ -299,10 +301,12 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
 	typval_T	*value;
 	dict_T		*d = tv->vval.v_dict;
 
-	if (d == NULL || d->dv_hashtab.ht_used == 0)
+	if (d == NULL || (d->dv_hashtab.ht_used == 0 && d->dv_type == NULL))
 	    return &t_dict_empty;
 	if (!do_member)
 	    return &t_dict_any;
+	if (d->dv_type != NULL)
+	    return d->dv_type;
 	if (d->dv_copyID == copyID)
 	    // avoid recursion
 	    return &t_dict_any;