I have the object x
with the type [key in string]: any
. I want to get key of type of x
but when I do keyof typeof x
, it's string
. How can I get the keys of x
?
My code. InbuiltRuleNames
is string
.
export type InbuiltRuleNames = keyof typeof rules;
// OBS: DONT CHANGE PREFIX!!!
// OBS: ADD ISSUE TO ISSUEIDS.md
export const rules: { readonly [name in string]: Rule } = {
'multiple-context-bindings': {
code: prefix(1),
message: 'Only one of [$0], can control descendant bindings. Separate into distinct elements.'
},
'no-viewmodel-reference': {
code: prefix(2),
message: 'Missing ViewModel reference in file $0'
},
'multiple-comment-bindings': {
code: prefix(3),
message: 'Can not have multiple bindings in the same comment.'
},
'javascript-syntax-error': {
code: prefix(4),
message: 'JavaScript syntax error.'
}
};