typescript get type of object property
type Data = {
value: number;
text: string;
};
type textProperty = Data["text"]; //string
//OR
const data = {
value: 123,
text: 'hello'
};
type textProperty = typeof data["text"]; //string
typescript get type of object property
type Data = {
value: number;
text: string;
};
type textProperty = Data["text"]; //string
//OR
const data = {
value: 123,
text: 'hello'
};
type textProperty = typeof data["text"]; //string
typescript type of object values
const data = {
value: 123,
text: 'text'
};
type Data = typeof data["text"]; // String
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us