# Using has\_type(list(Type), X) with user created type not working as expected

**URL:** <https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340>\
**Category:** Help!\
**Created:** [October 1, 2019, 5:38pm UTC](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340 "2019-10-01T17:38:25Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [October 2, 2019, 10:00am UTC](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340/7 "2019-10-02T10:00:47Z")

</div>

The issue seems to be

```prolog
:- begin_tests(example_bad).

test(1) :-
    has_type(list(key_value),[kv(1,a),kv(2,b)]).

:- end_tests(example_bad).

```

error:has\_type/2 is multifile, but not part of the interface of library(error). Type checking is done using must\_be/2 (throws error) or is\_of\_type/2 (fails)

```prolog
:- begin_tests(example_bad).

test(1) :-
    is_of_type(list(key_value),[kv(1,a),kv(2,b)]).

:- end_tests(example_bad).

```

With that change I get

```prolog
101 ?- run_tests.
% PL-Unit: example_bad . done
% test passed
true.

```

---

_[View the full topic](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340)._
