feat(runtime): add memoization to genericType()