Scenario
Imagine a scenario where a method called matter is returning an object in the form of return {content, data}
Issue
There is a conflict when the method is called a second time, as it overwrites any previous variables that were set from the return.
import matter from 'gray-matter'
const test = () => {
...
const { content, data } = matter(source1)
const { content, data } = matter(source2) // this causes the previous content and data variables to be overwritten
...
}
Objective / Inquiry
The goal is to set the return values in different named variables, for example:
const { content2, data2 } = matter(source2) // however, this results in a compile error as property content2 does not exist on type [...]
Therefore, the question remains; how can the return values be assigned to different named variables that match their type?