I have some values of symbol type in javascript and I need to convert it into typescript.
// Object values in Javascript
const size = {
Large: Symbol('large'),
Medium: Symbol('medium')
}
What is the best way to convert it into typescript?
Will this work for you?
interface Size {
LargeSize: symbol,
MediumSize: symbol
}
const size:Size = {
LargeSize: Symbol('large'),
MediumSize: Symbol('medium')
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.