Is it possible to get only the number keys as an type?
export const messageTypes = {
ABLEHNUNG_ECON: {
56: {
message: "Zählpunkt nicht gefunden",
event: function () {},
},
181: {
message: "Gemeinschafts-ID nicht vorhanden",
event: function () {},
},
},
ZUSTIMMUNG_ECON: {
175: {
message: "Zustimmung erteilt",
event: function () {},
},
},
ANTWORT_ECON: {
99: {
message: "Meldung erhalten",
event: function () {},
},
},
ABSCHLUSS_ECON: {
message: "Abschluss erhalten",
event: async function (userId: string) {
await sendNotification(userId, this.message);
},
},
};
If i do type MessageT = typeof messageTypes i get the whole object, but is it somehow possible to get only the numbers?
Result should be: type ResponseCodesT = 56 | 181 | 175 | 99
ABSCHLUSS_ECONdoesn't have any numeric key inside it, is this intentional or typo?