I’ve been mostly working on scala for the past few years and completely lost all my RS chops here (rewrote most of my orgs FE with reason-react) and there and I’m trying (slowly) pick it back up, and I was like “OH THIS FEELS SO FAMILIAR” as I was writing it until the compiler told me what was in my brain was wrong.
@module("shelljs")
external cd: (string) => string = "cd"
external exec: (string) => string = "exec"
let cloneInTemp = (temp: string): string => {
cd(temp)
}
I get no error.
let cloneInTemp = (temp: string): string => {
cd(temp)
exec("git clone git@github.com:myorg/myrepo.git")
}
Now throws an error
9 │
10 │ let cloneInTemp = (temp: string): string => {
11 │ **cd(temp)**
12 │ exec("git clone git@github.com:myorg/myrepo.git")
13 │ }
This has type: string
Somewhere wanted: unit
Playground Link here.
“Somewhere wanted: unit” just doesn’t make much sense to me because cd: string => string
and exec: string => string
, and cloneInTemp: string => string
.
Any help would be useful, it just seems whenever I have 2 statements after each other, they seem to not know how to handle it.
(also as an aside: I know that error handling has been something that’s changed since I last picked up RS, is there a corollary to “finally”?)