In typescript you can force all keys in an object type to start with a certain character:
type A = {
[key: `@${string}`]: number
}
// okay:
const a1: A = {
'@aaa': 10
}
// error:
const a2: A = {
'aaa': 10
}
how do I do the opposite? I don't want my keys to start with @, like this:
type A = {
[key: ????]: number
}
// error:
const a1: A = {
'@aaa': 10
}
// okay:
const a2: A = {
'aaa': 10
}