File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { type Result, trys } from "trycat"
1616
1717function readTextFileSync(path : string ): Result <string , string > {
1818 return trys (() => {
19- fs .readFileSync (path , " utf-8" )
19+ return fs .readFileSync (path , " utf-8" )
2020 }).mapErr ((err ) => {
2121 if (err instance of Error ) {
2222 return err .message
@@ -61,7 +61,7 @@ type ApiError = "InternalError" | "NetworkError" | "ServerError" | "UnexpectedRe
6161const WeatherSchema = z .object ({ ... })
6262type Weather = z .infer <typeof WeatherSchema >
6363
64- function fetchWeather(): Result <Weather , ApiError > {
64+ function fetchWeather(): Promise < Result <Weather , ApiError > > {
6565 const res = await tryp (fetch (" /api/weather" ))
6666 if (res .isErr ()) {
6767 return err (" NetworkError" )
@@ -86,7 +86,7 @@ function fetchWeather(): Result<Weather, ApiError> {
8686 return err (weather .error )
8787 }
8888
89- return ok (json .value )
89+ return ok (weather .value )
9090}
9191```
9292
You can’t perform that action at this time.
0 commit comments