Skip to content

TypeScript: setObject stateCommon is not allowed to have alias objects #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
foxriver76 opened this issue Jul 10, 2021 · 3 comments · Fixed by #878
Closed

TypeScript: setObject stateCommon is not allowed to have alias objects #865

foxriver76 opened this issue Jul 10, 2021 · 3 comments · Fixed by #878
Assignees
Labels

Comments

@foxriver76
Copy link
Contributor

foxriver76 commented Jul 10, 2021

I wanted to create an alias via setObject in a typescript script:

await setObjectAsync('alias.0.wohnzimmer.heizung.currentTemperature', {
    type: 'state',
    common: {
        name: 'Heizung Ist Temperatur',
        type: 'number',
        unit: '°C',
        read: true,
        write: false,
        role: 'value.temperature',
        alias: {
            id: 'hm-rpc.0.LEQ1513321.4.ACTUAL_TEMPERATURE'
        }
    },
    native: {}
});

On compilation the following error occurs:

javascript.0 (8389) script.js.common.aliasCreation: TypeScript compilation failed: alias: { ^ ERROR: Argument of type '{ type: "state"; common: { name: string; type: "number"; unit: string; read: true; write: false; role: string; alias: { id: string; }; }; native: {}; }' is not assignable to parameter of type 'Object'. Types of property 'common' are incompatible. Type '{ name: string; type: "number"; unit: string; read: true; write: false; role: string; alias: { id: string; }; }' is not assignable to type 'StateCommon'. Object literal may only specify known properties, and 'alias' does not exist in type 'StateCommon'.
@GermanBluefox
Copy link
Contributor

@AlCalzone Unfortunately I have no idea how to fix it.

@AlCalzone
Copy link
Collaborator

I'll check it out

@AlCalzone
Copy link
Collaborator

#878 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants