Answer the question
In order to leave comments, you need to log in
Kotlin: is there an analogue of the type operator from Typescript?
To set a limited list of string values in Typescript I do this
type Modes = 'simple' | 'medium' | 'advanced';
class Car {
name: string;
mode: Modes; // компилятор будет ругаться, если значение будет отличаться от перечисленных, и это хорошо
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question