E
E
Eugene2020-06-03 15:05:03
typescript
Eugene, 2020-06-03 15:05:03

How to determine valid strings?

How to determine a valid list of strings passed as a function parameter?

I tried

const enum Strings {
"abc"
}

function f(param: Strings) {
}


But when trying to pass "abc" an error occurs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-06-03
@you_are_enot

https://www.typescriptlang.org/play/index.html#code...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question