You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got object that has some function that returns various types. I have another object that is aware of the first object, and I need to know return type of function from first object
Example:
I've got first object like:
const tokens = {
// key below is name of token
month: {
possibleValues: ['jan', 'feb'], // etc...
filter: (monthName: string): number => {
return 12; // will return number 1-12
},
},
weekday: {
possibleValues: ['mon', 'tue'], // etc
filter: (monthName: string): Date => {
return new Date(); // will return Date of weekday
},
},
};
// as seen above - filter of 'month' always returns number and filter of 'weekday' returns Date
const parser: Parser<typeof tokens> {
parseWeekday: ({ weekday, month }) => {
// weekday should be detected to be Date type
// month should be detected to be number type
}
}
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
mhegazy commentedon Jun 8, 2017
duplicate of #6239, tracked by #6606
mhegazy commentedon Aug 17, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.