Closed petrisch closed 2 weeks ago
It's fixed in this commit, but it may take long before merged.
For now, you can add colon before the return type:
def foo [
test: string
]: nothing -> string { # <-----
$test
}
foo bla
Correct, we might should just close this and not fix it in tree-sitter-nu because improper syntax should show errors, right?
def foo [test: string]: nothing -> string { $test }
^
|___ Nushell is supposed to require this colon. It is a bug in nushell that an error isn't thrown.
@fdncred oh there is supposed to be a colon there, gosh I didn't consider that at all. Makes totally sense, and yes this is not TS-nu's fault then 😄
@petrisch right. the problem is that nushell doesn't currently enforce the colon to be there, but it should. that's a bug in nushell.
In this project I am trying to use return type annotations. Which in this minimal case give a error:
My best guess is, that in this line the return sequence is defined with a colon, which maybe should be a thin_arrow: https://github.com/nushell/tree-sitter-nu/blob/7e0f16f608a9e804fae61430ade734f9f849fb80/grammar.js#L148