Skip to content

Instantly share code, notes, and snippets.

@RoystonS
Created May 16, 2019 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoystonS/80f44cf2e50c8697322ac43e04cc26c0 to your computer and use it in GitHub Desktop.
Save RoystonS/80f44cf2e50c8697322ac43e04cc26c0 to your computer and use it in GitHub Desktop.
looksLike typing
type ComparisonPredicate<T> = (value: T) => boolean;
type ComparisonObject<T> = { [P in keyof T]?: ComparisonObject<T[P]> | ComparisonPredicate<T[P]> };
function looksLike<T>(obj: T, comparison: ComparisonObject<T>): boolean {
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment