G
G
GF2020-12-12 16:51:25
typescript
GF, 2020-12-12 16:51:25

How to specify the correct type?

I'm trying to make a function that would accept as a key - only the keys of an object of type string. It turned out to be done, but inside the function I cannot use key as an index. As I understand it, before using, you need to make sure that it's not never? Tell me where to dig.
Code:
5fd4caf881f43471832350.png
Sori that screen, there is no other now

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GF, 2020-12-12
@fomenkogregory

https://www.typescriptlang.org/play?#code/PTAEHUFM...
Here is the solution, how will I bring it to normal at the computer, it's very inconvenient to type from the phone)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question