const stringSpecs = 'Items to buy (array of strings)';
type StringSpecsOutput = MatchingOutput<typeof stringSpecs>;
// expected: string[]
const arraySpecs = ['groceriesArray', 'isPaid', 'notes'];
type ArraySpecsOutput = MatchingOutput<typeof arraySpecs>;
// expected: { groceriesArray: string[], isPaid: boolean, notes: string }
const dictSpecs = {
groceries: 'items to buy (array of strings)',
unitPrices: 'unit prices for all items (array of numbers)',
total: 'amount to pay (number)',
isPaid: 'true if paid',
notes: 'arbitrary notes'
};
type DictSpecsOutput = MatchingOutput<typeof dictSpecs>;
// expected: { groceries: string[], unitPrices: number[], total: number, isPaid: boolean, notes: string }
Generated using TypeDoc
Infers the expected output type for given Specs.