79097818

Date: 2024-10-17 11:23:27
Score: 0.5
Natty:
Report link

The answer of Alexander works, but if you want to exclude empty objects you can do this:

type HasTemplateProperty<T> = keyof T extends infer K
  ? K extends string
    ? K extends `_${string}`
      ? true
      : false
    : false
  : false;

type testA3 = HasTemplateProperty<{}>; // => never
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Janek Eilts