I
I
Islam Ibakaev2021-10-14 19:04:17
typescript
Islam Ibakaev, 2021-10-14 19:04:17

Why is typescript throwing an error?

There is such a file with action functions.
Typescript throws an error (55th line)

Property 'localId' does not exist on type 'Payload'.

The project uses authorization through the firebase rest api (an option with a login and password). I pass data in the request body (email, password) and receive data in the response (idToken, localId, and so on).
On line 55, I get this data from the response, but typescript complains that this data does not exist on the Payload type. And here the Payload type? It has to do with the request body object, and localId is a property of the response body object. Please tell me why this error is being thrown.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WbICHA, 2021-10-15
@devellopah

const { data: { localId, idToken, expiresIn } } = await axios.post(
      `https://identitytoolkit.googleapis.com/v1/accounts:${isLogin ? 'signInWithPassword' : 'signUp'}?key=${API_KEY}`,
      payload
    )

Type the date of the response.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question