arktype icon indicating copy to clipboard operation
arktype copied to clipboard

Support constraints for generic parameters

Open ssalbdivad opened this issue 1 year ago • 0 comments

Would use the expected syntax:

const inScope = scope({
  "box<s extends string>": {
    box: "s",
  },
});

const inType = type("<s extends string>", {
  box: "s",
});

Should also update tsGenerics from the default scope to include the appropriate constraints, e.g. Record<K extends string | number | symbol, V> (currently we need a @ts-expect-error comment here to avoid a semantic validation error when checking the indexed key definition).

ssalbdivad avatar Jun 17 '23 18:06 ssalbdivad