Skip to content

Instantly share code, notes, and snippets.

@jasonbyrne
Created January 16, 2022 18:07
Show Gist options
  • Select an option

  • Save jasonbyrne/b40f4fa81b53bd16b18272ad342e3f35 to your computer and use it in GitHub Desktop.

Select an option

Save jasonbyrne/b40f4fa81b53bd16b18272ad342e3f35 to your computer and use it in GitHub Desktop.
Generic Value Wrapper
class WrappedValue<T> {
constructor(
public name: string,
public value: T
) {}
}
const data: WrappedValue[] = [
new WrappedValue<string>("First Name", "Jason"),
new WrappedValue<string>("Last Name", "Byrne"),
new WrappedValue<number>("Age", 40),
new WrappedValue<boolean>("Vaccinated?", true),
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment