DEV Community

HarmonyOS
HarmonyOS

Posted on

[Smart Watch] [API 12] After defining data types in a single frame, the system always prompts 'Structural typing is not ...'

Read the original article:[Smart Watch] [API 12] After defining data types in a single frame, the system always prompts 'Structural typing is not supported' when calling

[Smart Watch] [API 12] After defining data types in a single frame, the system always prompts 'Structural typing is not supported' when calling

Problem Description

An object is defined using class in an ets file, but when it is called in other files, it always prompts 'Structural typing is not supported'.

Reason for the problem

The same object is defined in different files, and although the object structure is completely consistent, it does not belong to the same object. Therefore, when defining parameter types in methods, there may be parameter type inconsistency errors

Solution

Ensure that each object in the project is defined only once. If this object needs to be used, it is best to introduce the same ETS to ensure that the same object introduced in all files is consistent

Written by Emine Inan

Top comments (0)