Skip to content

Bug: ImageProps.sizing w, h, x, y are typed number but should be Coord #1065

@BistroStu

Description

@BistroStu

Version

Please specify what version of the library you are using: [ 3.10 ]
Please specify what version(s) of PowerPoint you are targeting: [ any ]

Expected / Desired Behavior / Question

When the sizing properties of ImageProps are specified as a percentage of the slide dimensions, the code should compile in Typescript, because it works at runtime:

new pptxgen().addSlide().addImage({
	data: imgData,
	sizing: {
		type: "contain", 
		w: "90%",
		h: "75%",
		x: "5%",
		y: "20%"
	}
});

sizing w, h, x, y should be typed Coord, the same as PositionProps and others.

Observed Behavior

Typescript reports error "Type 'string' is not assignable to type 'number'." because those four properties are all typed number.

Steps to Reproduce

Type the above into VS Code.

I will submit a pull request.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions