Default parameters and Typescript

Hi,
I am trying to make node-red library with TypeScript.
Problem is that I cannot set required server in default paramteres.
With javascript and html a lot of libraries do it.
Now in my code I have
" defaults: {
operation: { value: AmpioOutOperation.UpperCase },
name: { value: "" },
server: {type:"xyz_config", required:true}
},"
and I cannot compile because of server field.
Can someone give me a hint how to fix it?

BR

It is unclear what your issue is.

Are you getting a typescript error?

Are you getting a runtime error after compilation?

Perhaps if you provide more detail we can assist.


PS:

Please use the </> code toolbar button BEFORE pasting code into a post (it keeps the code nicely formatted and readable)

example...

defaults: {
    operation: { value: AmpioOutOperation.UpperCase },
    name: { value: "" },
    server: {type:"xyz_config", required:true}
},

is FAR more readable than..

" defaults: {
operation: { value: AmpioOutOperation.UpperCase },
name: { value: "" },
server: {type:"xyz_config", required:true}
},"

Thanks, I am quite new to this forum. I am using Node-RED for more than a year but first time creating library.
I had typescript error but for this moment, I did some workaround.
Thanks for response :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.