T cannot be found in Js


#1

Hello, I’m kinda new in Reason, I’m trying to use bs-axios, creating an instance with it, Im trying to set the ~params labeled parameter, it request me a Js.t('a) type but writing a Js.t object it gives me the next message: t cannot be found in Js.

I hope you’re having a good day!


#2

You can create objects in a couple of different ways, one of the simplest is using the syntax sugar: https://bucklescript.github.io/docs/en/object-2#literal


#3

Hey @notpineapple, I hope you figured it out. This is how an bs-axios instance looks like in one of my projects:

let instance =
  Axios.Instance.create(
    Axios.makeConfig(
      ~baseURL="/api",
      ~headers={"Authorization": "Bearer " ++ accessToken},
      (),
    ),
  );

If you are still not able to get it to work, can you share the object you wrote?


#4

Thank you so much for your answers, i could get it with the syntatic sugar %bs.obj form @yawaramin answer.

@ben i’ll try the way you do.

Besides that can you explain me why is not finding t in Js?

I hope you’re having a good day.


#5

Can you post the code and the error message? That will help to identify the exact issue and explain it.