In my TypeScript code, I have defined an interface and two constants:
interface Foo {
readonly name: string;
};
const FOO_1: Foo = {
name: 'zing'
};
const FOO_2: Foo = {
name: 'baz'
};
Is there a way to find all instances of Foo
based on the value of the name
property, without the need to keep them in a separate list? For instance, I am looking for a solution to retrieve all instances of Foo
with the name zing
. This should return FOO_1
.