- Qt 6.11
- Qt Qml
- Qt Qml Tooling
- qmllint
- QML Lint Warning and Errors
- Unresolved type
- Qt 6.11.1 Reference Documentation

Unresolved alias ◦ Unterminated non-empty case block

# Unresolved type

This warning category is spelled `[unresolved-type]` by qmllint.

This category contains following warnings:

- Type is used but is not resolved
- Type was not found for the return type of method
- Type was not found for the type of parameter in method
- Property has incomplete type; You may be missing an import
- Type of property not found; This is likely due to a missing dependency entry or a type not being exposed declaratively
- Type of property not fully resolved; This is likely due to a missing dependency entry or a type not being exposed declaratively
- Type not found in namespace

These warnings usually indicate missing imports or faulty QML modules, depending on whether you are using or writing a QML module.

## For QML module users

### What happened?

You used a type that was not found by QML tooling. It usually indicates a potential typo, a missing import, or improperly set up import paths.

### Why is this bad?

The type can't be found by QML tooling, and most likely not by the QML engine.

### Examples

#### Typo

     import QtQuick

     Item { ... }

To fix this warning, correct the typo:

     import QtQuick

     Item { ... }

#### Missing import statement

     Item { ... }

To fix this warning, import the module that exposes `Item`:

     import QtQuick

     Item { ... }

If adding the import statement does not help, take a look at your import paths.

If you get this warning via QML Language Server, your setup might be incomplete.

## For QML module authors

### What happened?

The QML tooling can't find a type in your QML module. It can be a type that you expose to QML directly or indirectly by using it as a:

- Base type
- Property type
- Signal, slot, or `Q_INVOKABLE` parameter type
- `Q_INVOKABLE` return type

You might be missing a declarative type registration if the unresolved type is exposed by your module.

Otherwise, your QML module might have undeclared dependencies to the QML module exposing the unresolved type.

### Why is this bad?

The QML tooling will not work on your types and users of your QML module will get spurious warnings that they can't fix.

### Examples

#### Missing type registration

Refer to Defining QML Types from C++ on how to register your types declaratively. Make sure that all types and enums exposed directly and indirectly to QML are registered.

#### Missing QML module dependency

Let `MyItem` be a C++ type in your QML module:

     class MyItem: public QQuickItem {
         ...
         QML_ELEMENT
         ...
         Q_PROPERTY(SomeType someProperty READ someProperty WRITE setSomeProperty NOTIFY somePropertyChanged)
         ...
     }

The QML tooling can't resolve `MyItem` correctly if it can't resolve `QQuickItem` or `SomeType` first. If `QQuickItem` lives in the `QtQuick` QML module and `SomeType` in `SomeModule`, then you need to state these C++ dependencies in the QML module definition.

To achieve that, add the dependencies to the QML module definition. This can be done with `DEPENDENCIES`, for example:

     qt_add_qml_module(
         ...
         DEPENDENCIES
             QtQuick # for QQuickItem to be resolved
             SomeModule # for SomeType to be resolved
     )

Refer to declaring C++ dependencies between QML modules for more information.

Unresolved alias ◦ Unterminated non-empty case block