microsoft / TypeScript-DOM-lib-generator

Tool for generating dom related TypeScript and JavaScript library files
Apache License 2.0
618 stars 418 forks source link

Use more precise type: Canvas.createPattern #1808

Open utenma opened 3 weeks ago

utenma commented 3 weeks ago

createPattern arg repetition type is widened to string

however According to MDN should be "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

location in repo https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/baselines/dom.generated.d.ts#L5747

current signature

createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;

expected signature

type PatternRepeatMode = "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

createPattern(image: CanvasImageSource, repetition: PatternRepeatMode | null): CanvasPattern | null;
HolgerJeromin commented 3 weeks ago

Just to make the issue clear: Currently we have this in current master.

createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;