Civet icon indicating copy to clipboard operation
Civet copied to clipboard

Default values in `::` object argument types are `unknown` when they could be inferred

Open STRd6 opened this issue 7 months ago • 1 comments

When mixing :: types and default values in function arguments spacing is type unknown when we could probably infer it as number.

export function DisplayOptions({
  stage,
  position:: Vec2,
  options:: {
    text: string
    onSelect: () => void
  }[],
  spacing = 60
}) { }

STRd6 avatar May 22 '25 02:05 STRd6

Probably the subtype should default to typeof defaultValue when there's an assigned default value like this. Good idea!

edemaine avatar May 22 '25 03:05 edemaine