I'm really struggling to understand this part:
import axios from 'axios'
import * as TE from 'fp-ts/lib/TaskEither'
export const getIntent = (sessionId: string, input: string) => process.env.INTENT_URL
? TE.tryCatch(
() => axios.post(`${process.env.INTENT_URL}`,{sessionId, input}),
reason => String(reason))
: TE.left(Error("No INTENT_URL")
)
It seems like Left
is being assigned a value of type String
and/or Error
, even though they are not the same. How does this code pass type checking???