extended the OptimizedSvg interface to include path, and info width and height. (#38317)

This commit is contained in:
Gavin Gregory 2019-09-26 20:12:58 -04:00 committed by Ben Lichtman
parent f161e550b4
commit 793e9f235f
2 changed files with 20 additions and 4 deletions

View File

@ -1,9 +1,10 @@
// Type definitions for svgo 1.2
// Type definitions for svgo 1.3
// Project: https://github.com/svg/svgo
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
// Gilad Gray <https://github.com/giladgray>
// Aankhen <https://github.com/Aankhen>
// Jan Karres <https://github.com/jankarres>
// Gavin Gregory <https://github.com/gavingregory>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -201,7 +202,11 @@ interface SvgInfo {
interface OptimizedSvg {
data: string;
info: object;
info: {
width: string;
height: string;
};
path?: string;
}
declare class SVGO {

View File

@ -27,5 +27,16 @@ const options: SVGO.Options = {
svgo = new SVGO(options);
// SVGO instance methods
svgo.optimize(`<?xml version="1.0" encoding="utf-8"?><svg></svg>`, { path: "filepath" })
.then(result => result.data, error => error);
svgo
.optimize(`<?xml version="1.0" encoding="utf-8"?><svg></svg>`, {
path: 'filepath',
})
.then(
result => {
result.data;
result.info.height;
result.info.width;
result.path;
},
error => error,
);