意外字符错误在使用可选链时发生

huangapple go评论93阅读模式
英文:

Unexpected character error when using optional chaining

问题

ThingsDB文档中我了解到,应该可以使用“双点”语法来实现可选链。然而,即使尝试了示例或我能想到的最简单的语法,我都收到一个关于意外字符 . 的错误。

( nil )..x;

我做错了什么?可选链似乎不按照描述的那样工作。

英文:

From the ThingsDB documentation I understand that it should be possible to use optional chaining by using a "double dot" syntax.
However, even when trying the examples or the most simple syntax I can think of, I get an error complaining about an unexpected character ..

( nil )..x;

What am I doing wrong? Optional chaining doesn't seem to work as described.

答案1

得分: 1

你很可能没有将你的 ThingsDB 节点升级到最新版本。

可选链接语法是相对较新的,只在版本1.4.6中引入。(撰写时的最新版本为1.4.13)

我在 v1.4.13 中尝试了你的示例,它运行正常!

你可以在 @node 范围内使用 node_info().load().version; 来检查你的版本;

英文:

Most likely you did not upgrade your ThingsDB nodes to the latest version.

Optional chaining syntax is relatively new and only introduced in version 1.4.6. (The latest version at the time of writing is 1.4.13)

I've tried your example in v1.4.13 and it works fine!

You can check your version using node_info().load().version; in a @node scope;

huangapple
  • 本文由 发表于 2023年5月15日 15:34:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76251811.html
  • thingsdb
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定